Added a window listener to catch the frame closing event, which will
bring up a confirmation prompt before actually closing.