When the pc is attached to a single screen via Display Port and that monitor is turned off, Ubuntu 24.04 locks the screen. This was not the case in 22.04, if I recall correctly. I'm wondering if this is intended behavior, since any program running is killed on lock.
Looks like gnome interprets a powered off DP monitor as a blank screen. After switching off the setting under
Privacy & Security > Screen Lock > Automatic Screen Lock
and starting a new session the problem is gone, although this is not optimal, since an actual blank screen won't lock the pc either.