Fixes in connection closing