For cutting off the supply to the motor normally closed (NC) contacts of limit switch (LS) should be wired in series with interposing relay coil of respective direction of the valve so that when valve reaches their respective direction contact will open and cut the control supply. For indication normally open contacts (NO) of opposite direction of valve should be used so that when valve fully closes open indication contact should remain NC only and vice-versa.
So for close direction
NC contact of close direction