Valves closing automatically on disconnecting the line and opening on reconnection thereof