closeWindow function

Close the current window.