fix flush on windows
refactor
unregister from ioloop when pipes are flushed
spacing between functions/methods