connection closing fixes