Fix autologout

Triggerbot now correctly logs out users upon disconnecting. It will also
save the database, regardless of its state, so no data could be lost.