Set the JFrame's default close operation to EXIT_ON_CLOSE.