I admit it seems weird. I wonder if there is anything in the laptop that kills the core. It can happen. You may have already done this, but try a really simple laptop, for example a=10, drop the connection and then see if you can print(a)after re-recording.
However, a way to avoid the problem as a whole is to use screen or tmux to create a permanent sshs session. This is what many people working on remote servers do.
source
share