Fixes socket leak in HTTP server.

Fixes #1643.
Merge pull request #1647 from mc-server/SocketThreadsFix

Fixes socket leak in HTTP server.