Fix potential exception on OSX

There was a potential error that could show up on OSX if the user closed the dialog with the X button. This suppresses that.