Only close existing ZMQ context's. Fixes #8635.