added close functionality to the window