cleanup connection lost method and and command clearing