A browser can: close all tabs in a window; can close all windows; can resource limit runaway pages. A browser cannot tell if you want a given tab.
If a site designer thinks that a UX with user accounts should open many concurrent tabs, maybe the UX should undo the “open many tabs” when the consumer states that they are now no longer using the tabs (by logging out).
As with most of the stuff that I put into an article on here, I start with a literature search. As far as I found, every JS close() function is attached to a popup library. For example, an article from 2013 1