function shutwin(){window.opener=null;window.open('','_self'); window.close();}
<button onclick="shutwin();">close</button>