add close button functionality