An unpinned SessionStore._db is None, so the eval failed with AttributeError before reaching its assertion.
It now reads the ended session through the store's scoped persistence handle (sessions.get and the record's end_reason) and closes the store's handles with close_all_db_handles.