If you schedule a script as a scheduled task, or call it externally, and want to make sure the PowerShell process really ends, here is a brute force approach:
#requires -Version 2 Stop-Process -Id $Pid -Force
This line kills the PowerShell host that is executing the script.