udpate window.close code sequence