Call db.close() in the complete handler for a version change transaction, before the success event associated with the open call fires On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". dbname = "intversion-close-in-oncomplete.html" indexedDB.deleteDatabase(dbname) request = indexedDB.open(dbname, 7) upgradeNeeded(): db = event.target.result PASS event.newVersion is 7 db.createObjectStore('os') transaction = event.target.transaction transaction.oncomplete: sawTransactionComplete = true db.close() openError(): PASS sawTransactionComplete is true PASS event.target.result is undefined. PASS event.target.error is non-null. PASS event.target.error.name is "AbortError" Expecting exception from transaction = db.transaction('os', 'readwrite') PASS Exception was thrown. PASS code is DOMException.INVALID_STATE_ERR PASS ename is 'InvalidStateError' Exception message: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing. PASS successfullyParsed is true TEST COMPLETE