try catch around file operations