Instead of manually calling close(), you can use the Morphik client as a context manager:
Sync
Async
from morphik import Morphikwith Morphik() as db: doc = db.ingest_text("Sample content") # Session is automatically closed when exiting the with block
from morphik import AsyncMorphikasync with AsyncMorphik() as db: doc = await db.ingest_text("Sample content") # Client is automatically closed when exiting the with block