Turning off motors if Serial Communication fails

To be honest, I grabbed that part of the code from somewhere on the interwebs and tweaked it to make it work for me. I do not fully understand it, any simple way to explain to me how that part of the code works?