Just because the book is moving doesn't tell you anything about the forces on it, or even whether there ARE any.
Just look at Newton's first law of motion, and this time, let's try and THINK about it too. It says something to the effect that any object continues in constant, uniform MOTION ..... UNLESS acted on by an external force.
In some unusual applications of unusual components, I can think of unusual electric circuits where a switch may be connected in parallel with a device in order to control it.
But I'm sure this is not what's intended in a question on the high-school level.
Until you get in a situation with tricky applications in a tricky circuit, your switches will always be connect <em>in series</em> with the devices they control.
It does not violate the law of conservation of energy. The oscillation stops when the energy is lost and the energy is lost because it becomes heat that is created by the air resistance and many other forces found in the surrounding of the oscillating spring.