Once you enter the while loop, you never touch cm again so if it's less than 70 at that point, your code will never exit the motor function.
Once you enter the while loop, you never touch cm again so if it's less than 70 at that point, your code will never exit the motor function.