try catch for saving files