Catch exceptions when saving files.