Apple close to deal protecting Ireland in fight over EU tax grab