public void closeOnError() {
        // Print a dialog box then handle it.
        JOptionPane.showMessageDialog(frame,"ERROR: The server broke.",
                "Server Crash", JOptionPane.ERROR_MESSAGE);
        
        for (ConversationView value : usernameToChats.values()) {
              value.setVisible(false);
              value.dispose();
        }
        setVisible(false);
        dispose();
    }