On windows a socket and file descriptor aren't the same kind of handle, pass the type to Close so it uses the right api to close it.