The close() method of the IDBDatabase interface returns immediately and closes the connection in a separate thread.
close()
MDN Reference