fixing code up and catching general exception for closed zk connection