note the code in closeWindow is incomplete