avoid error when user cancel "Save as" prompt