Use file.append
Merge pull request #18818 from rallytime/cp-18297

Backport #18297 to 2014.1