Throw an error if the file couldn't be saved