Handle connection closing on windows
* Don't dispose the writer  (?)
* Use FlushAsync