Death animation doesn't play when player health is less than zero

I have created a prefab that decreases player’s health. When player health reaches zero, a death animation should be played. All animations organized on blend trees based on player direction.

The death state can be reached from any state and the transition has a trigger named dead.

The gameobject should be destroyed at the end of the animation.

Death animation is supposed to be played completely, but actually only the first frame is played.

PlayerStats.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerStats : MonoBehaviour
{
	private Animator anim;
	private Rigidbody2D rb;
	private SpriteRenderer sr;
	[SerializeField] private int maxHP = 100;
	[SerializeField] private int HP;
	[SerializeField] private bool electric;
	[SerializeField] private bool heal;
	[SerializeField] private bool orange;
	[SerializeField] private bool lemon;

	// Start is called before the first frame update
	void Start()
	{
		anim = GetComponent<Animator>();
		rb = GetComponent<Rigidbody2D>();
		sr = GetComponent<SpriteRenderer>();
		HP = maxHP;
	}

	// Update is called once per frame
	void Update()
	{
		anim.SetBool("electric", electric);

		if (orange)
			sr.color = Color.Lerp(Color.HSVToRGB( 40.0f / 360.0f, 0.3f, 1.0f), Color.white, Mathf.PingPong(Time.time, 1));
		else if (lemon)
			sr.color = Color.Lerp(Color.HSVToRGB( 60.0f / 360.0f, 0.3f, 1.0f), Color.white, Mathf.PingPong(Time.time, 1));
		else if (heal)
			sr.color = Color.Lerp(Color.HSVToRGB(300.0f / 360.0f, 0.3f, 1.0f), Color.white, Mathf.PingPong(Time.time, 1));
		else
			sr.color = Color.white;

		if (HP < 0)
		{
			rb.bodyType = RigidbodyType2D.Static;
			anim.SetTrigger("dead");
		}
	}

	public void SetElectric(bool electric)
	{
		this.electric = electric;
	}

	public void SetHeal(bool heal)
	{
		this.heal = heal;
	}

	public void SetOrange(bool orange)
	{
		this.orange = orange;
	}

	public void SetLemon(bool lemon)
	{
		this.lemon = lemon;
	}

	public int GetMaxHP()
	{
		return this.maxHP;
	}

	public int GetHP()
	{
		return this.HP;
	}

	public void SetHP(int HP)
	{
		this.HP = HP;
	}

	public void Kill()
	{
		Destroy(gameObject);
	}
}

YellowTileAction.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class YellowTileAction : MonoBehaviour
{
	private Animator anim;
	private GameObject player;
	private PlayerStats stats;

	// Start is called before the first frame update
	void Start()
	{
		anim = GetComponent<Animator>();
		player = GameObject.FindGameObjectWithTag("Player");
		stats = player.GetComponent<PlayerStats>();
	}

	// Update is called once per frame
	void Update()
	{
		
	}

	private void OnTriggerEnter2D(Collider2D collision)
	{
		if (collision.gameObject.CompareTag("Player"))
		{
			stats.SetElectric(true);
			anim.SetBool("isEntered", true);
			StartCoroutine(nameof(Hurt));
		}
	}

	private void OnTriggerExit2D(Collider2D collision)
	{
		if (collision.gameObject.CompareTag("Player"))
		{
			stats.SetElectric(false);
			anim.SetBool("isEntered", false);
			StopCoroutine(nameof(Hurt));
		}
	}

	private IEnumerator Hurt()
	{
		while (stats.GetHP() >= 0)
		{
			yield return new WaitForSeconds(0.1f);
			stats.SetHP(stats.GetHP() - 5);
		}
	}
}

Had to disable Can Transition To to make it work.