Disable canvases when pressing escape to resume game

Am newbie to C# but very familiar with Unity. Using my pause menu, when I press my escape key once, it pauses the game, I then load my Pause Menu canvas which has resume, settings, quit to menu, quit to desktop. The settings panel inside the canvas has an onclick to disable the pause menu and load the settings menu panel. after doing this, if I press my escape key, there is nothing to tell the settings menu panel to be disabled and it stays in game, and if i press escape again, the pause menu and the settings panel are now both being displayed.
Youtube video of the issue in a more visual way.

Code below is my pause menu script

using UnityEngine;
using UnityEngine.SceneManagement;

public class PauseMenu : MonoBehaviour
{
    protected CharacterMotorConfig Config;
    public static bool GameIsPaused = false;
    public Behaviour HUD;
    public GameObject pauseMenuUI;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Cursor.visible = true;
            if (GameIsPaused)
            {
                Resume();
            }
            else
            {
                Pause();
            }
        }
    }

    public void Resume()
    {
        pauseMenuUI.SetActive(false);
        Time.timeScale = 1f;
        GameIsPaused = false;
        Debug.Log("Resuming Game");
        Cursor.lockState = CursorLockMode.Locked;
        HUD.enabled = !HUD.enabled;
    }
    void Pause()
    {
        pauseMenuUI.SetActive(true);
        Time.timeScale = 0f;
        GameIsPaused = true;
        Cursor.lockState = CursorLockMode.None;
        HUD.enabled = !HUD.enabled;
    }

    public void LoadMenu()
    {
        Debug.Log("Loading Menu");
    }

    public void QuitToDesktop()
    {
        Debug.Log("Quitting Game");
        Application.Quit();
    }
    public void QuitToMenu()
    {
        Resume();
        SceneManager.LoadScene("MainMenu");
    }
}