Mibew Messenger 1.6.4 is outdated, vulnerable and officially unsupported.
Also one should understand that the feature you want to implement is not so trivial for Mibew 1.6.x.
I'd recommend to modify function
print_thread_messages in
libs/chat.php to add into the resulting xml document the information that the thread is closed. And to modify
updateContent method in
chat.js to make use of that information. Also, in that case it will be necessary to store the actual state of the thread on the client side, so it will be possible to do some actions (close the window) only on change of the state.
But that's only a kind of general idea excluding possible pitfalls. And you'll have to implement it yourself.