I've had trouble closing my powershell script. I've got some forms from PowerGUI and included a function at the beginning of the handler that loads the form.
Simple task: Check a variable. If it's $false, close the program/application.
exit and break throw a Microsoft .Net Error, which can be clicked away when pressing "Continue" and the script continues.
Here are the details of the .net error. http://pastebin.com/phdspwsT
Thank you very much!