Fix client shutdown