The program will now only close when the cancel button is pressed.