public void WGSafeQuit(String sender) {
        for(Game game : new HashSet<Game>(games.values())) {
            if(saveGame(game)) {
                sendMessage(sender, "Game " + game.id + " saved.");
            }
            else {
                sendMessage(sender, MSG_SAVEERROR);
            }
        }
        
        // Wait a second or 2, otherwise the bot will quit before the queue is processed
        try {
            Thread.sleep(2000);
        } catch (Exception e2) {
            // Do nothing.
        }
        
        disconnect();
        System.out.println("Exiting, WGSAFEQUIT command issued.");
        System.exit(0);
    }