Fix permission issue when generating the file.