You could use:
code:
Interop.Call('User32', 'PostMessageW', ChatWnd.handle, 16, 0, 0);
To close the window. All it does is posts WM_CLOSE to the chat window.
Closing group chats takes some extra work, but you can cheat and post an enter keystroke like so:
code:
Interop.Call('User32', 'PostMessageW', ChatWnd.handle, 16, 0, 0);
Interop.Call('User32', 'PostMessageW', ChatWnd.handle, 256, 0, 1835009);
Hope this helps