Add shutdown hook to destroy context

Add an isClosed method to ZSocket