Don't use DestroyWindow anyways, it doesn't give a chance for the window to clean up. Instead, you have quite a few options:
[list=1][*]Send "/close" to the chat window (not recommended because it shows up in the recent messages list and won't work if commands are disabled)
[*]Send a WM_COMMAND message with the menu identifier of the Close menu item
[*]Send a WM_CLOSE message
[*]
Call CloseWindow on the chat window - this doesn't close it, nevermind[/list]
The WM_CLOSE method is probably the best to use