fixes #1561 exception while trying to shutdown client