Improved the console closing process when there are changes (now it
doesn't close if user presses cancel).