Handle exceptions during file saving.