Potential error handling on file write