The equipment exists, but it requires more than a pump and switch.
There are controllers that will shut off a pump from a no-flow condition, but they often require a manual reset condition.
What you suggest doens't work by itself because the pressure drops off when the pump shuts off and the pump starts again, creating a nasty cycling condition. The solution is to put a small pressure tank after the pump, and a check valve on the suction side of the pump. When the valves close, the pressure increases and the switch shuts off the pump.
Another solution, if you have electric valves, is to use the irrigation controller to operate the pump. When a valve is opened, the controller closes a relay to start the pump.
If your controller doesn't do that, you can put a relay on each valve circuit so that applying power to open any of the valves will start the pump.