cleanup resources should be called within IO thread if client is shuttin...

...g down