Error: A foreground process is already running

Double-check to install the robot in Service-Mode and before running the unattended job, make sure that you are logout (logoff) from the robot machine.

Then check this documentation for your Service-Mode robot: Background Process Automation