The OSCustomizationSpec, the script creates is nonpersistent, which means it will be kept as long as your PowerCLI session runs.
You can explicitely remove it with
Remove-OSCustomizationSpec -OSCustomizationSpec $oscust -Confirm:$false
Or add that line to the end of the script.
Another option is to stop/start your PowerCLI session