关闭特定的XMLHttpRequest

How to "rebuild" function to close specific XMLHttpRequest? I have defined variable outside function to call xhr.abort(); everywhere I need. Now is possible, with this solution, close last running XMLHttpRequest if running more than one at same time - processes before last running are without control after replace xhr by re-calling _ajax()

var xhr;

function _ajax(data, callback) {
  xhr = new XMLHttpRequest();
  xhr.open('POST', window.location.pathname, true);
  xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  xhr.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      callback(this);
    }
  };
  xhr.send(data);
}

/* close fnc */
xhr.abort();

You could use xhr as an array and store there all the requests; then you can call abort on any one of them. Like:

var xhr=[];
function _ajax(data, callback) {
    xhr.push(new XMLHpptRequest);
    //etc
}
xhr[0].abort();
xhr.shift(); //get rid of the aborted request