issue-658: correctly close socketpair fds when socketpair fails

This applies patch by glider.