BF: remove race condition on socket removal with -x

The non-messy parts of #399