Press F key to OPEN/CLOSE door

I’m a beginner.
I’m sure that OPEN/CLOSE animations are correct.
But it always plays CLOSE animation.

How do I fix it?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OPEN : MonoBehaviour {
    public GameObject Player;
    private bool IsOpen = false;

    void Start () {
		
    }
	
    void Update () {
		
    }

    void OnTriggerStay(Collider other)
    {
        if (IsOpen == false)
        {
            if (((other.gameObject == Player) && Input.GetKeyUp(KeyCode.F))==true)
            {
                GetComponent<Animation>().Play("OpenDoor");
                IsOpen = true;
            }
        }

        if (IsOpen == true)
        {
            if (((other.gameObject == Player) && Input.GetKeyUp(KeyCode.F)) == true)
            {
                GetComponent<Animation>().Play("CloseDoor");
                IsOpen = false;
            }
        }
    }
}

Ah, that’s a simple mistake. After the first if statement is run, the second if statement also runs which then immediately closes the door. Here’s a simple fix:

         if (IsOpen == false)
         {
             if (((other.gameObject == Player) && Input.GetKeyUp(KeyCode.F))==true)
             {
                 GetComponent<Animation>().Play("OpenDoor");
                 IsOpen = true;
             }
         } else if (IsOpen == true) // change the second if statement to an 'else if'
         {
             if (((other.gameObject == Player) && Input.GetKeyUp(KeyCode.F)) == true)
             {
                 GetComponent<Animation>().Play("CloseDoor");
                 IsOpen = false;
             }
         }

That should do the trick.