fix close socket and log display