windows: fix handling closed socket while poll handle is closing

fixes #1278

(backport from master for v0.10 branch)