add close chat window function and fix UI bugs