Set UTF-8 encoding on non-binary file open & close to fix issue #131.

Fix #131 - Python was assuming platform default encoding for files, causing it to choke on a mismatch. Set to UTF-8.