The European Union and Moldova have agreed on an energy security plan aimed at weaning the country off its dependence on Russian supplies and integrating it into the 27-nation bloc’s network.