Write queue after connect windows

I don't like passing the callback here. Please check the handle type and call the appropriate function instead. Also assert if we get the wrong handle type.