added check for close button as per BZ 785203