I managed to overcome the issue I had.
I'm posting the solution here because I've seen others that came across the same problem as I did.
First of all you should download the JQuery library. Once it has downloaded save it in the "webim/js" folder. Rename it to "jquery.js".
Then edit the "webim/styles/default/templates/chat.tpl" (if you are using the default template). In the head section of that file add the following:
<script type="text/javascript" language="javascript" src="${webimroot}/js/jquery.js"> </script>
.............................................
<script type="text/javascript">
jQuery(window).unload(function(){
jQuery("a.closethread").trigger("click");
});
</script>
Look at the picture attached to see exactly where to put the line codes above. If you add the code lines different, it's possible for the script added not to work.
And that's it. Now, each time a visitor closes his browser window, he apears as he had logged out.
Note: Because the window.unload() event triggers if the page is refreshed, the visitor is also logged out if he refreshes the page manually. And please excuse my bad english.