proper client shutdown