Write queue after connect windows

After looking at this again, I think I'd rather see this function split in 2: one on tcp.c which works for TCP and another one on pipe.c which does it's job for pipes.

Yes, they'll almost be the same, but there is no real code to be reused here, just a loop iteration.