title: Unable to receive message in popup once popup closes on tab change
body: <p>I've made a chrome extension that downloads some stuff from a certain site. Basically, it goes around through all links I'm interested in, stores them in an array and then downloads it one by one. The thing is, the storing is done in a separate file called <code>download.js</code>. Then, I proceed to send a message to <em>popup.js</em> using <code>chrome.extension.sendRequest</code>. I pick it up in <em>popup.js</em> with <code>chrome.extension.onRequest.addListener</code>. It works perfectly when I don't switch my tab, but I'd like it to work while I'm browsing some other stuff in the meantime. I can see the code reaching the point to send the request to <em>popup.js</em> through a console log, but I can't see what's going on in <em>popup.js</em> because when I switch my tab the popup console immediately closes.</p>
  
  <p><em>download.js</em>:</p>
  
  <pre class="lang-js prettyprint-override"><code>// logic behind link gathering and storing that works
  ...
  gatherLinks().then(function() {
    // logs is defined, don't worry
    chrome.extension.sendRequest(logs);
  )};
  </code></pre>
  
  <p><em>popup.js</em>:</p>
  
  <pre class="lang-js prettyprint-override"><code>document.addEventListener('DOMContentLoaded', function() {
    var downloadButton = document.getElementById('download');
    downloadButton.addEventListener('click', downloadStuff);
  });
  
  function downloadStuff() {
    chrome.tabs.executeScript({
      file: 'jquery-3.1.1.min.js'
    });
    chrome.tabs.executeScript({
      file: 'download.js'
  });
  
  chrome.extension.onRequest.addListener(function(message_logs) {
    message_logs.forEach(function(log) {
      chrome.downloads.download({
        url: log.link,
        filename: log.filename
      });
    }
  }
  </code></pre>
  
  <p><em>manifest.json</em>:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
    ...   
  
    "permissions": [
      "tabs",
      "activeTab",
      "downloads"
    ],
  
    "background": {
      "scripts": ["download.js"]
    }
  }
  </code></pre>