Added listener for close button (red X)