Fixed bug where QUIT is sent on every call to cleanup-and-quit