so after some research I found out that a locked machine goes to sleep after a short while even if you have automatic sleep set to never, but I don't really know if that's the problem you describe. anyways, here's a fix for that: you have to set the DWORD value of this registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0
to 2. then in the advanced power options window set the sleep → system unattended sleep timeout to zero minutes so it never does it.
you have to change the registry key because by default this setting is not visible.
let the luck be on our side