Yesterday I was playing around with a small DC Motor ,(ones which you can find inside a toy) and found something interesting. I took a cell and fixed one terminal of the cell to a terminal of the Motor with the help of wires and kept the other terminal of the cell open, waiting to be connected. When I touched the open terminals of the cell and the motor, the motor would obviously start rotating, but also along with sparks ,due to the second law of thermodynamics. After I disconnected one of the wire, the current flow stops ,but the motor keeps on rotating due to inertia. When the motor completely stops, I repeatated the process and the same thing occured again. BUT, when I retouched the open terminals while the motor was still rotating due to inertia, the sparks would not come out.The sparks started to appear again when the motor (rotating in inertia), slowed down. But the intensity of the sparks would be lower than when the motor was not rotating at all. I repeated this experiment many times and the same result came out. I repeated the experiment by reversing the terminals and as intuition told, it showed the same result. I came up with some explanation for it, but I'm not sure of anything so far.
What is the possible reason of this phenomenon?