How do I stop a timeline with triggers?

So I decided to use a timeline and animation clips to make automated cinematics. It plays perfectly fine upon hitting the entry trigger, but when hitting the exit trigger it just restarts the timeline rather than stopping it entirely.

Here is the cinematic trigger script:

public class CinematicTrigger : MonoBehaviour {

    public PlayableDirector director;
    public PlayableAsset timeline;
    

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {

		
	}

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {

            director.playableAsset = timeline;
            if (director.state != PlayState.Playing)
            {
                director.Play();
            }
            else if (director.state == PlayState.Playing)
            {
                director.Stop();
            }
            
        }
    }
}

Try this instead as the assignment of the timeline is causing the director to stop:

         if (director.state != PlayState.Playing)
         {
             director.playableAsset = timeline;
             director.Play();
         }
         else if (director.state == PlayState.Playing)
         {
             director.Stop();
         }