Socket cleanup for Windows

Jira Issue: WP-1251