Buggy code:
public class Main { public static void main ( String [ ] args ) { JFrame mainMenuFrame = new JFrame ( ) ; mainMenuFrame . setTitle ( "Main<seq2seq4repair_space>Menu" ) ; mainMenuFrame . setExtendedState ( Frame . MAXIMIZED_BOTH ) ; mainMenuFrame . setLocationRelativeTo ( null ) ; mainMenuFrame . setUndecorated ( false ) ; mainMenuFrame . setDefaultCloseOperation ( JFrame . DO_NOTHING_ON_CLOSE ) ; URL sssLogoUrl = Main . class . getResource ( "//SimpleSaleSystemLogo.png" ) ; URL posIconUrl = Main . class . getResource ( "//Point-of-SaleIcon.png" ) ; URL posIconHoverUrl = Main . class . getResource ( "//Point-of-SaleIconHover.png" ) ; URL dashboardIconUrl = Main . class . getResource ( "//DashboardIcon.png" ) ; URL dashboardIconHoverUrl = Main . class . getResource ( "//DashboardIconHover.png" ) ; URL inventoryIconUrl = Main . class . getResource ( "//InventoryIcon.png" ) ; URL inventoryIconHoverUrl = Main . class . getResource ( "//InventoryIconHover.png" ) ; URL reportIconUrl = Main . class . getResource ( "//ReportsIcon.png" ) ; URL reportIconHoverUrl = Main . class . getResource ( "//ReportsIconHover.png" ) ; JPanel fullScreenPanel = new JPanel ( ) ; fullScreenPanel . setBorder ( new EmptyBorder ( 10 , 10 , 10 , 10 ) ) ; fullScreenPanel . setLayout ( new GridLayout ( 3 , 1 , 10 , 10 ) ) ; mainMenuFrame . add ( fullScreenPanel ) ; JPanel topPanel = new JPanel ( ) ; topPanel . setLayout ( new GridLayout ( 1 , 1 , 10 , 10 ) ) ; fullScreenPanel . add ( topPanel ) ; JLabel mainMenuTextLabel = new JLabel ( new ImageIcon ( sssLogoUrl ) ) ; topPanel . add ( mainMenuTextLabel ) ; JPanel middlePanel = new JPanel ( ) ; middlePanel . setLayout ( new GridLayout ( 1 , 2 , 10 , 10 ) ) ; fullScreenPanel . add ( middlePanel ) ; JPanel bottomPanel = new JPanel ( ) ; bottomPanel . setLayout ( new GridLayout ( 1 , 2 , 10 , 10 ) ) ; fullScreenPanel . add ( bottomPanel ) ; JButton salesTransButton = new JButton ( new ImageIcon ( posIconUrl ) ) ; ImageIcon salesTransButtonHover = new ImageIcon ( posIconHoverUrl ) ; salesTransButton . setBorderPainted ( false ) ; salesTransButton . setRolloverIcon ( salesTransButtonHover ) ; salesTransButton . setRolloverEnabled ( true ) ; salesTransButton . setFocusPainted ( false ) ; salesTransButton . setContentAreaFilled ( false ) ; middlePanel . add ( salesTransButton ) ; JButton dashboardButton = new JButton ( new ImageIcon ( dashboardIconUrl ) ) ; ImageIcon dashboardButtonHover = new ImageIcon ( dashboardIconHoverUrl ) ; dashboardButton . setBorderPainted ( false ) ; dashboardButton . setRolloverIcon ( dashboardButtonHover ) ; dashboardButton . setRolloverEnabled ( true ) ; dashboardButton . setFocusPainted ( false ) ; dashboardButton . setContentAreaFilled ( false ) ; middlePanel . add ( dashboardButton ) ; JButton inventoryButton = new JButton ( new ImageIcon ( inventoryIconUrl ) ) ; ImageIcon inventoryButtonHover = new ImageIcon ( inventoryIconHoverUrl ) ; inventoryButton . setBorderPainted ( false ) ; inventoryButton . setRolloverIcon ( inventoryButtonHover ) ; inventoryButton . setRolloverEnabled ( true ) ; inventoryButton . setFocusPainted ( false ) ; inventoryButton . setContentAreaFilled ( false ) ; bottomPanel . add ( inventoryButton ) ; JButton reportsButton = new JButton ( new ImageIcon ( reportIconUrl ) ) ; ImageIcon reportsButtonHover = new ImageIcon ( reportIconHoverUrl ) ; reportsButton . setBorderPainted ( false ) ; reportsButton . setRolloverIcon ( reportsButtonHover ) ; reportsButton . setRolloverEnabled ( true ) ; reportsButton . setFocusPainted ( false ) ; reportsButton . setContentAreaFilled ( false ) ; bottomPanel . add ( reportsButton ) ; salesTransButton . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent arg0 ) { new PosFrame ( ) ; } } ) ; dashboardButton . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent arg0 ) { JFrame myFrame = new JFrame ( ) ; myFrame . setTitle ( "Make<seq2seq4repair_space>Sale" ) ; myFrame . setExtendedState ( Frame . MAXIMIZED_BOTH ) ; myFrame . setLocationRelativeTo ( null ) ; myFrame . setVisible ( true ) ; } } ) ; inventoryButton . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent arg0 ) { new ViewInventoryFrame ( ) ; } } ) ; reportsButton . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent arg0 ) { new ReportsMenuFrame ( ) ; } } ) ; mainMenuFrame . addWindowListener ( new WindowAdapter ( ) { public void windowClosing ( WindowEvent e ) { int confirm = JOptionPane . showOptionDialog ( null , "Are<seq2seq4repair_space>you<seq2seq4repair_space>sure<seq2seq4repair_space>you<seq2seq4repair_space>want<seq2seq4repair_space>to<seq2seq4repair_space>close<seq2seq4repair_space>this<seq2seq4repair_space>window?" , "Exit?" , JOptionPane . YES_NO_OPTION , JOptionPane . QUESTION_MESSAGE , null , null , null ) ; if ( confirm == ( JOptionPane . YES_OPTION ) ) { try { DbConnector . closeConnection ( ) ; System . out . println ( "DB<seq2seq4repair_space>connection<seq2seq4repair_space>closed." ) ; <START_BUG> mainMenuFrame . dispose ( ) ; <END_BUG> } catch ( SQLException sqle ) { JOptionPane . showMessageDialog ( null , "Error:<seq2seq4repair_space>The<seq2seq4repair_space>connection<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>database<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>closed<seq2seq4repair_space>properly" , "DB<seq2seq4repair_space>Connection<seq2seq4repair_space>Error" , JOptionPane . ERROR_MESSAGE ) ; sqle . printStackTrace ( ) ; } } } } ) ; mainMenuFrame . setVisible ( true ) ; } }

Fix:
System . exit ( 0 ) ;