Ugly fix for problem with closing Client.