If I may be permitted to make a remark from the sidelines:

> I don't like this solution since it would still trigger save stack
> overflow when there is an unclosed group at the end of the document.
>
> I quite prefer the usual warning about an open group at the end of
> document over having a save stack capacity overflow triggered.

Unclosed groups are likely obstacles for translation of LaTeX to
formats like the usual tex4ht targets.

                                    -- Bill