stop client properly