EU seeks to avoid crisis after Brexit