Given a list of lifecycle event strings events, determine whether the sequence is valid. Each event is one of "PLAN", "EXECUTE", "DEFECT", "RETEST", or "CLOSE". A valid sequence must follow these rules: PLAN must occur before any other event, EXECUTE can occur only after PLAN, every DEFECT must be matched by a later RETEST, and CLOSE can appear only once at the end after all defects have been retested. Return True if the sequence is valid, otherwise return False.
def validate_lifecycle(events):