EU energy ministers agree on emergency measures