Update permissions of temp file to match that of original file.
Merge branch 'JustAdam-generatefile-fix'