client hangs after shutdown fixes #issue821