The flags for an invisible fence should remain up until the final training phase of your pet is completed, to ensure that they have learned all the necessary information.