Properly close all handlers

* FlushFileBuffers before disconnect
* close all handlers in PipeListener Close()