This is the common issue most of us are facing, there are multiple ways to fix this but i have no clue definitely which one will work: i will suggest you for trail and error for all following methods:
• Setting up the rdp RemoteDesktop_SuppressWhenMinimizedin the registry: UI Path scripts are failing when RDP is disconnected
• Use launch Interactive invoke workflow activity while invoking the wokflow.
• Config RDP timeout to create user session.
• Check simulate Type/Windows Type for background automation.