Please note that the disconnect session (close the Remote Desktop) does not equal to logged off. When a session is in a disconnected state, running programs are kept active even though the user is no longer actively connected. However, there can be some setting to force end a disconnected session after a maximum time. This will end up the session consider as log off.
https://petsbee.com/