Real Madrid have reached an agreement with UEFA to formally end their involvement in the European Super League, bringing the controversial project to a close.