Fix bot not shutting down correctly on restart