Are you sure that your getting the full stop position on it?
In this picture of yours the lever needs to go up about three positions to switch it off.
On mine, I have to put the lever into the on and choke on position to get the top cover off, then in order to get the switch on the normal on position I have to push the lever up and thats then in the full throttle position, pull the trigger and the lever pops into the normal on position where when I let off the trigger it can idle.
From there I have to put the lever UP again to switch the saw off.
Here's the lever in the normal running position where I can let the trigger off and it will idle...
And here's the spring that grounds the wire, on this picture the spring isn't contacting the brass so the saw could run.
Now, in this picture the lever is up as far as it will go (almost touching the airbox if its called that) and the spring is contacting the brass wire end connector.
That springy bit of metal acts as a contact on the brass end of the wire thing.
It could be that the black wire has come off somewhere else but to be honest I've not taken mine to bits to see exactly where it goes, from working on motocross bikes I'm assuming it's connected to the coil and acts as a ground when you stop the saw.
All those pics are of my 017 which as far as I know is just an older version of your 170.
Sorry for the dirt but at least the filters clean and I was cutting some punky wood up the other day.