Fix newly onset onClose bug