Then one browser tab is associated with one http-session. In this case the listener is called when closing the tab.
When using session mode "COOKIE":
Then several browser tabs share the same http session - each browser tab belongs to one internal dialog session. The dialog session is closed when closing the tab. The http-session remains. The http-session is closed on time out. (Why is it not closed "with the last brower tab"? Because the jsessionid-cookie remains on client side - so any new tab would again reference the http-session).
And just as side info: please always use the "Dialog Session" if you want to refer to the "session of the tab". The "Dialog Session" is an abstraction - which internally maps to the http-session in "URL"-tracking scenarios and which internall maps the the internal dialog session on "COOKIE"-tracking scenarios. The dialog session provides corresponding listeners for getting notified when it is closed.