title: Trying to create and download thousands of files not working now
body: <p>Ok so I wrote this program to avoid having to manually reformat several >6000 entry csv files by hand. It froze on the first run of the full file, then ran fine when i gave it a 1000 entry chunk i got 1000 files in my downloads folder. Now it won't download more than 51 at a time. The rest are converted to my XML format but they don't automatically download. </p>
  
  <pre><code>&lt;script src="./papaparse.min.js"&gt;&lt;/script&gt;
  &lt;script src="./jquery-2.2.1.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var data;
    var j = 1001;
    function handleFileSelect(evt) {
      var file = evt.target.files[0];
  
      Papa.parse(file, {
        header: true,
        dynamicTyping: false,
   //     preview: 5,
        step: function(results, parser) {
          j++
  //        console.log("Row data:", results.data);
  //        console.log("Row errors:", results.errors);
  //        $("#test").text(results.data["0"]["correct_answer"]);
  
  var dataArray = [j,
                    results.data["0"]["question_id"],
                    results.data["0"]["node_id"],
                    results.data["0"]["part_text"],
                    results.data["0"]["distractor_1"],
                    results.data["0"]["distractor_2"],
                    results.data["0"]["distractor_3"],
                    results.data["0"]["correct_answer"],
                    results.data["0"]["explanation"]];
  
  dataArray = HTMLGunkCleanse(dataArray);
  
  XMLWriter(dataArray[0],
            dataArray[1],
            dataArray[2],
            dataArray[3],
            dataArray[4],
            dataArray[5],
            dataArray[6],
            dataArray[7],
            dataArray[8]);
  
  
        }//end of the line for stuff to do with each iteration of data
  
        })
      };
  
  function HTMLGunkCleanse(dataArray){
  var regex = /&lt;[^&gt;]*&gt;/g;
  for (i = 3;i&lt;8;i++){
  dataArray[i] = dataArray[i].replace("&lt;p&gt;", "\r\n").replace("&lt;/p&gt;", "").trim();
  var check = dataArray[i];
  dataArray[i] = dataArray[i].replace(regex, "").replace("\\s+", "").trim();
  if (check != dataArray[i]){
  console.log(check);
  console.log(dataArray[i]);  // shows any differences that may have occured
    }
  }
  
  return dataArray
  }
  
  function XMLWriter(fileName, qID, nodeID, question, d1, d2, d3, correct, feedback){
  
  
  setTimeout(function(){console.log("waiting");},1)
  
  //create long ugly string that looks good in xml
  
  
  
   var blob = new Blob([doc.toString()], {
   type: "text/plain;charset=utf-8"
   });
  
   var url = URL.createObjectURL(blob);
  
   var a = document.createElement('a');
   a.download = "cfal_question_00006_" + fileName + ".dita";
   a.href = url;
   a.textContent = "Download latest";
   a.click();
   //if the click() function dosen't work you can try using onclick() fucntion like this
   //a.onclick();
  
  
   document.getElementById('test').appendChild(a);
   }
  
  
    $(document).ready(function(){
          $("#csv-file").change(handleFileSelect);
  
  
    });
  &lt;/script&gt;
  &lt;input type="file" id="csv-file" name="files"/&gt;
  &lt;div id="test"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>In preresponse to question yes i realize its ugly. I've taken one javascript class and don't some stuff online so i'm kinda newish. Any advice on why it was working fine and doesn't work now? I am using Google chrome to run it btw. </p>