Use native file.write
Merge pull request #18855 from rallytime/cp-18275

Backport #18275 to 2014.1