You need 8 connected to GND.
It works! Without pins 8 and 9.
You need 8 connected to GND.9 is optional can be used as flyback diode protection for inductive loads.
Which means its _not_ optional as your motors are inductive loads. Failure to use suchfreewheel diodes when driving inductive loads can destroy your whole circuit in theworst case.