You could also use an automatic shut off valve.