title: Unblock IndexedDB
body: <p>Trying to use IndexedDB. I wrote a function that creates new Table and indexes and bring back callback.</p>
  
  <p>But when I tried to use that function, it stop working - after <code>onsuccess</code> state I got <code>onblocked</code> state and <code>onupgradeneeded</code> doesn't run...</p>
  
  <p>How can I avoid blocking DB?</p>
  
  <pre><code>crtTable(db_name, table, indexes, callback) {
      console.log("Initiate table creation");
      let isSupport:boolean = this.checkDbSupport();
      if(!isSupport) return;
  
      let version;
      let openRequest = indexedDB.open(db_name);
      openRequest.onsuccess = (event) =&gt; {
          console.log("Opening DB and find version");
          version = (event.target as any).result.version;
  
          //I GOT DB VERSION AND NOW I TRYING TO CLOSE IT!
          (event.target as any).result.close();
  
          version++;
  
          console.log("reopen DB with new version")
          let openRequest = indexedDB.open(db_name, version);
  
          openRequest.onblocked = (event) =&gt; {
              console.log("blocked");
          }
  
          openRequest.onupgradeneeded = (event) =&gt; {
              console.log("update running")
              let db = (event.target as any).result;
  
              let transaction = db.createObjectStore(table[0], { keyPath: table[1] });
              for(let index of indexes) {
                  transaction.createIndex(index[0], index[0], { unique: index[1] });
              }
              transaction.oncomplete = (event) =&gt; {
                  console.log("indexes setted");
              }
              callback("updated");
              console.log("updated");
          };
  
          openRequest.onsuccess = (event) =&gt; {
              openRequest.result.close();
              callback("success");
              console.log("success");
          };
  
          openRequest.onerror = (event) =&gt; {
              openRequest.result.close();
              callback("error");
              console.log("error");
          };
      };
  }
  </code></pre>