How to stop a BTTask_BlackboardBased in its tick() function?

I don’t know how to code to stop the task. My code is as follows:

void UMyBTTask_BlackboardBase::TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
    float XValue = (GetWorld()->GetTimeSeconds() - SplineTimeStart) / MoveTotalTime;
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::SanitizeFloat(XValue));
    if (XValue <= 1) 
    {
        GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::SanitizeFloat(XValue));
        SplineDistance = CurveFloat->GetFloatValue(XValue) * SplineLength;
        TourGuidePawnLocal->SetActorLocation(SplineLocal->GetLocationAtDistanceAlongSpline(SplineDistance, ESplineCoordinateSpace::World), false, nullptr, ETeleportType::None);
        TourGuidePawnLocal->SetActorRotation(SplineLocal->GetRotationAtDistanceAlongSpline(SplineDistance, ESplineCoordinateSpace::World), ETeleportType::None);
    }
    else
    {
        OnTaskFinished(OwnerComp, NodeMemory, EBTNodeResult::Succeeded);
        return;
    }
}

void UMyBTTask_BlackboardBase::OnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult)
{
    return;
}

However, it’s ticking all the time… What’s wrong with it?