Refactored additional calls to open().
PEP8 cleanup.
Merge pull request #114 from jacebrowning/open-cleanup

Refactor all `.write()` calls into one function.