win: Run close callbacks after polling for i/o

Fix for #796

/cc @piscisaureus