Working on close event and text appending for the chat