Fix way of catching connection close by other side.