fix issue with closing connection where is chained