I found the solution!!

Add window.opener=self; to the script and windows no longer bugs you to close the window!!