Thanks for the question.
You get the TransactionInactiveError because the delete operation you want to preform happens in a callback of the ajax call.
The indexeddb is autocommitting, meaning once the actions on the transaction are done, the transaction commits. Meaning in your case, once all results in the cursor are iterated, the transaction will be commited. The transaction doesn't wait on possible extra calls that can be made due an async callback.
So what you should do is delete the item immediately or open an new transaction for every delete.