title: Why does closing a form and then going to a variable cause my powershell to crash?
body: <p>So I have a script where I am trying to make a GUI version of a text menu. I currently have an option from the text menu to launch a GUI menu. I want a button to return to the text menu but make the close button (the "x") on the form exit the script entirely. </p>
  
  <p>I thought I can just close the GUI with <code>Form.Close()</code> and then call my text menu variable afterwards but that causes my PowerShell session to crash.</p>
  
  <p>Here is the code I mentioned nested within an <code>Add_Click</code> scriptblock:</p>
  
  <pre><code>$Text_Menu.Add_Click({
      $MainMenu_GUI.Close()
          .$MainMenu
      })
  </code></pre>
  
  <p>I was hoping this would close the GUI and just return to the text menu but it instead has a way more catastrophic result...Anyone know why, or maybe how I can accomplish what I described the desired result to be? Any advice is much appreciated!</p>