keras/src/legacy/saving/serialization.py/SharedObjectSavingScope/__exit__
class SharedObjectSavingScope:    def __exit__(self, *args, **kwargs):
        if not getattr(self, "_passthrough", False):
            global SHARED_OBJECT_SAVING
            SHARED_OBJECT_SAVING.scope = None