added clear button, stop listening client closing