Is is possible to break out of the times loop. Something like:
5.times { // do some stuff if (status != "OK") { break }