fixed socket closed issue