connection close bug fix