Changed code for stopping upstart services

The for loop wasn't working so I used a while loop