fixed bug that i created in build 0b7bd164ebd0b792aa17b321d2997bffc3c76ab4
adding checking closing connection