Clean up BufferWriter, should fix issues on Windows. Closes #688