modify server close method