I'm gonna stick with 1 battery powering both Vin and Motor Driver as being the culprit.
Motor sucking down the voltage and resetting the Arduino.
9V little square batteries only good for a couple hundred mA, will drain pretty quick.
Those look like the sparkfun geared motors you find in this kit?
4 AA work better to power a motor shield.