EU to take legal action against UK over Brexit