Help with non stop looping animation!!

I have this script to open a door once the character gets close to it. In this animation the door opens, stays open for around 5 seconds, and closes after that. But the bool will never set back to false even if im not close to the door anymore, any ways to fix that?

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

public class DoorOpeningScript : MonoBehaviour {

    private Animator anim;

	// Use this for initialization
	void Start () {

        anim = GetComponent<Animator>();

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

    private void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Player")
        {
            anim.SetBool("open", true);
        }

    }
}

You have to set bool to false manually, You can check if player left the door open area, if so, then use anim.SetBool(“open”,false) or another way is use “trigger” instead of bool . Here’ s the code may work:

 using System.Collections;
     using System.Collections.Generic;
     using UnityEngine;
     
     public class DoorOpeningScript : MonoBehaviour {
     
         private Animator anim;
     
         // Use this for initialization
         void Start () {
     
             anim = GetComponent<Animator>();
     
         }
         
         // Update is called once per frame
         void Update () {
             
         }
     
         private void OnTriggerEnter(Collider other)
         {
             if(other.tag == "Player")
             {
                 anim.SetBool("open", true);
             }
     
         }
    
    private void OnTriggerExit(Collider other)
         {
             if(other.tag == "Player")
             {
                 anim.SetBool("open", false);
             }
     
         }
     }