Often when linux becomes unresponsive (even via ssh), it is because memory usage is high and it is constantly swapping. Try turning off swap space, then it may just kill the "offending" application instead of swapping. Running 'swapoff -a' may do the trick (until next reboot I guess).
I have also read somewhere, than the RPI4 can easily overheat, especially in a closed case. If you have a closed case, try running without the top cover to increase heat dissipation.
Swap can be easily turned off permanently by commenting out the corresponding line in /etc/fstab
Overheating was surely not the problem. The CPU is cooled by a case fan and it was pretty cool outside during the night.
But I will try with swap turned off/zRAM enabled.
Atlas Pro AZ-EQ, ASI1600MM-Pro, ASI120MM-S, ES102ED, WO-Z61, Nikon D3300, ASI-EFW, ZWO LRGB,Ha,O3,S2 filter set