Allow terminating contexts

Currently there is no way to wait for pending messages to be sent out before a script quits. This change exposes an API to terminate the ZMQ contexts with zmq_term which will wait if ZMQ_LINGER is set to -1.