avoid EADDRINUSE error when running selftest repeatedly

"writer" socket is bind
"reader" socket is connect

When the bind socket is closed first, the TIME_WAIT state occurs for
the listening side. Thus when the selftest is executed too soon after
a previous run, the bind will fail with EADDRINUSE.

By closing the connecting socket first, the TIME_WAIT state occurs for
the connecting side, which is using an ephemeral port, thus the above
problem is avoided.