Correct some bad socket closing on Windows.