Added error handling for file reading/writing