Close socket when factory fails.
The socket is not exposed to the outside anyway, so it should be closed.
Merge pull request #12 from clue/factory-close

Close socket when factory fails.