Add drain method to wait until output is transmitted

Uses tcdrain on unix. On win, has same action as flush.

This can be useful to know when data has "left the pipe". The windows mapping is not as clean. FlushFileBuffers is more analogous to tcdrain, rather than tcflush.