Use wsaduplicatesocket instead of dup on windows to avoid crashes

Fixes #105.