Pause Menu Not Going Away

Script problem again. Tried for almost a week on figuring this out. The script I have for the Pause Menu does everything it needs to do except for close the Pause Menu after I press escape again. Here it is:

#pragma strict

var Canvas : GameObject;

function Update () {

        if(Input.GetKeyDown("escape")){
            Canvas.SetActive(true);
            Cursor.visible = true;
            if(Time.timeScale == 1.0)
                Time.timeScale = 0.0;
        }

        else if (Canvas.SetActive == true)
                Cursor.visible = true;
                if(Time.timeScale == 0.0)

        {

            if(Input.GetKeyDown("escape")){
                Canvas.SetActive(false);
                Cursor.visible = false;
                if(Time.timeScale == 0.0)
                    Time.timeScale = 1.0;
        
            }
        }
    }

Just avoid Code Duplication, your problem will eventually be solved.

function Update () {
       if (Input.GetKeyDown("escape")){
         	Canvas.SetActive(!Canvas.activeSelf);      // switch canvas state 
            Cursor.visible = !Cursor.visible;           // switch visible state
            SwitchTimeScale();                          // switch timeScale
         }
}

function SwitchTimeScale ()
{
	  if(Time.timeScale == 1.0){
      	Time.timeScale = 0.0;
      } else {
      	Time.timeScale = 1.0;
      }
}