add logic to close nsqd