Hello.
When using the remote desktop, logging out of the user usually results in disconnection of the remote desktop session. This is because the logout operation terminates the current user's session, which in turn disconnects the RDP from the remote host. If you want to keep your system secure during a remote session but need to continue running certain tasks instead of completely disconnecting, try locking the screen. Lock the screen as follows: In the remote desktop window, press Ctrl + Alt + End, then select Lock.
To disable disconnection, you can configure the prohibited actions through the Group Policy Editor (gpedit.msc). Under User Configuration, navigate to Administrative Templates > Start Menu and Taskbar. Look for and enable Delete and block access "Disconnect".
I hope this helps.
Best regards