Fixed runtime error when user closed save file dialog