Turning Network on and off

I have the following Shell command - OS X 8.5, Xojo 2013 R 3.3

' tell shell to stop networking
dim myShell as new shell
myShell.Execute "networksetup -setnetworkserviceenabled Ethernet off"[/code] 

The above was working ok. Now getting this:

Error code: 7
Result: ** Error: Unable to commit changes to network database.

The above is in a method that is called by a method that was changed to a Thread.

Is having this in a Thread the problem or what?