Working on onClose method