you might help prevent this from happening by setting a policy on the server to automatically disconnect when idle.
To change this setting, go to Administrative Tools \ Terminal Services Configuration.
press Connections in the left hand pane, and then right click RDP-Tcp and select Properties.
In the resulting window opt for Sessions tab.
it’s possible for you to set it lower if you’d like.
Change the radio button to “Disconnect from session” when session limit is reached.
This will make all sessions automatically mark as disconnected on the server.