Engine separation won't cause automatic closure of valves, but the resulting low pressure will illuminate lights (including the Master Caution light) on the panels and display messages on the displays.
The pilots will have to react to the engine separation, the same way than for an engine fire or severe malfunction. This non normal procedure includes shutting down the fuel line by setting the engine start lever to CUTOFF or triggering the fire bottles on the affected engine.
There is a spar fuel valve (or fuel shutoff valve) fixed to the wing and to the fuel tank, which stays on the wing in case of separation. This valve is to prevent leaks due to a broken line. As the hydraulic power may be missing after the engine damage or separation, the valve is controlled by an electric motor with a backup battery and a double wiring redundancy.
Example on the the B737 NG:
(Shut-off valves framed in purple, Sourcesource)
Non-Normal checklist used: ENGINE FIRE or Engine Severe Damage or Separation
(NNC 8.2 of the Quick Reference Handbook).
(Click to enlarge, source)