fix close button function