Sorry, I automatically assumed you had a diode across the relay - I didn't think to ask.
The relay coil is an inductor (so is the motor), and when it switches off, the magnetic field created when current is flowing through it collapses, and induces a current in the opposite direction. This is very brief but can potentially damage the output pin or transistor switching the relay. The diode absorbs the spike.
I thought that the purpose of the diode was to block the spike. May just be a semantic issue, but I think of capacitors as absorbing current and diodes as blocking it.