Problem: process hangs on exit if there are open sockets

Old issue with libzmq shutdown that cannot handle open sockets. The
correct strategy for an application is to correctly call zsock_destroy
on all sockets before exiting. When the app does not do that, we want
to detect it and warn the user, and not call zmq_ctx_term() stupidly.

Solution: count number of open sockets in zsys and if non-zero, do not
call zmq_ctx_term() in exit handler.
Merge pull request #480 from hintjens/master

Problem: process hangs on exit if there are open sockets