fixed error when server close with exception handling