Lithuania, Estonia and Latvia have reached an agreement to restrict Russian access to the EU through their borders because of the war in Ukraine.