fixes #1561 exception while trying to shutdown client
Merge pull request #1571 from gurbuzali/issue1561/3.2-master

fixes #1561 exception while trying to shutdown client