private void closeApp() {
        int result = JOptionPane.showConfirmDialog(
            this,
            "Are you sure you want to exit the application?",
            "Exit Application",
            JOptionPane.YES_NO_OPTION);

        if(result == JOptionPane.YES_OPTION) {
            mainPanel.unsibscribeAll();
            if(session != null) {
                try {
                    session.logout();
                } catch(RemoteException | ChatRoomInvalidStateException e) {
                    e.printStackTrace();
                }
            }
            dispose();
            System.exit(0);
        }
    }