Some browsers will not honor the command unless it is user initiated. But ... Here is a workaround that might work for you. try instead of close :
open(location, '_self').close();
Or maybe trick the browser into thinking that it was user initiated. It may or may not work; not tested. I'm just throwing spaghetti against the wall ...
var btn = document.createElement('button'); document.body.appendChild(btn); btn.addEventListener('click', function() { open(location, '_self').close(); }, false); btn.dispatchEvent(new Event('click'));
source share