Ah right, that makes sense. It sometimes takes a few moments to register that the crabs aren't aggressive, and these moments can be enough to log you out if the mouse or keyboard haven't been interacted with for a little while. If you increase the frequency of the random movements that the script makes, this should be sufficient to keep you logged in
-Apa