def _cleanup(cls):
        """Cleanup function that will be called when the Python process exits"""
        instance = cls.get_instance()
        if instance._browser and instance._loop:
            # Create a new event loop if the main one is closed
            try:
                loop = instance._loop if instance._loop.is_running() else asyncio.new_event_loop()
                asyncio.set_event_loop(loop)
                loop.run_until_complete(instance._browser.close())
            except:
                pass  # Suppress any errors during shutdown
Cleanup function that will be called when the Python process exits
src/upsonic/server/level_utilized/bu/browseruse.py