What are you really trying to accomplish? Because what you are asking is not possible. Not only is there no way to detect when a browser is closed from a page loaded into the browser, without a signed applet, page code has no way to affect or even see the client file system.
Or are you asking about a desktop program monitoring browser instances? It'd help if you'd spend a bit more time explaining your scenario and requirements.
Something tells me this is a web application that creates a folder on the server for a client. That folder is only relevant while the client is still active on the web application.
As said before there is no way to find out when the browser is closed. But there's something close. HttpSession has a matching listener, HttpSessionListener. You configure the usage of such a listener in the web.xml file. You then use the sessionDestroyed method to be notified when the session is removed. This may be hours after the browser is closed, but it's as close as you're going to get.