fix .END and closed connection on terminal side