Couple of points, the A3977 DOES NOT TOLERATE anything over 35V, and that includes back emf. So Practically don't run it at more than 27VDC power supply voltage. 2nd, you might get some thermal adhesive and glue a heatsink to the 3977. Something that has verticle height and plenty of fin area to pull some heat out of the chip.