fix issue with closing ws connection