- Now also closing buffered writer
- Added some more debug messages