(TWILL-110) added state guard to prevent possible race-condition when shutting down zk client, which causes deadlock.