The script should log out in a safe spot if you've configured breaks. Unless you're saying that the script is being logged out due to the AFK timer?
If this is the case, I'd strongly suggest increasing the frequency of random movements. This way, the bot will keep you logged in (though still simulating partial AFKing), and you won't be in this position.
-Apa