Hi Iwata,
I am not sure if you can detect a browser close, but what you could do is trigger an event on session destroy, see https://forum.mendix.com/link/space/microflows/questions/99927
I hope this helps.