program now exits when JFrame is closed