minor bugfixes

- read_file now reads as UTF-8 since write_file writes using this
encoding
- close access to open files bugfix