Enemy Follows the Player Even His Death Animation Triggered

I have a 2D game project and I am coding but still on learning level. If I put simply, its based on player’s escape and enemy follows to hurt him. Important case is, I am using A* PathFinding for this because there are obstacles for enemies and they need to pass them.(A stars pathfinding here: https://arongranberg.com/astar/ )

Problem is: Enemy following Player, wherever he goes on the flat rectangular scene, but when I kill enemy while following, his death animation triggered and he dies in 3 seconds but he still keeps following me while he is dying process going on and even when he is lying down on the ground. Simply flies to me.

What I need is to make him stop at that very location when his "isDead" parameter gets triggered. Because of A* using, I couldn’t find a way to do it and override A* somehow.

This is the code I use for attack when close to player, and isDead function:

public float stopDistance; private float attackTime; private bool isCloseForAttack; public float attackSpeed;  public void Update() {     animator = gameObject.GetComponent<Animator>();      if (player != null && !isDead)     {         if (Vector2.Distance(transform.position, player.position) > stopDistance)         {             animator.SetTrigger("isNotRunning");         }         else         {             animator.SetTrigger("isRunning");             if (Time.time >= attackTime)             {                 StartCoroutine(Attack());                 attackTime = Time.time + timeBetweenAttacks;             }         }     }      IEnumerator Attack()     {         player.GetComponent<Player>().TakeDamage(damage);          Vector2 originalPosition = transform.position;         Vector2 targetPosition = player.position;          float percent = 0;         while (percent <= 1)               percent += Time.deltaTime * attackSpeed;         float formula = (-Mathf.Pow(percent, 2) + percent) * 4;         transform.position = Vector2.Lerp(originalPosition, targetPosition, formula);         animator.SetTrigger("attackMove");          yield return null;      } } }