what you CAN do is empty the document content and tell the user that he/she is not allowed to view the site's content, you can't close the browser window/tab.
but if you are opening your site from another page using window.open()
then open it in OK/true condition in the confirm message in that page else close the window using window.close()
in the cancel/false condition
to clear out content
document.body.innerHTML = '';