Set "w" flag when opening AtomicFileCreate output
Fix NameErrors
Merge pull request #4 from alphagov/fix-tempfile-mode

Fix bugs in AtomicFileCreate