Added some code for closing Client connections