Stop leaking mutex in nmworker and cond in nm socket
On FreeBSD, the pthread primitives are not solely allocated on stack, but part of the object lives on the heap. Missing pthread_*_destroy causes the heap memory to grow and in case of fast lived object it's possible to run out-of-memory.
Properly destroy the leaking mutex (worker->lock) and the leaking condition (sock->cond).
(cherry picked from commit 57d0faba)
Closes #3051 (closed)