Christine Lagarde's early departure comes ahead of France's presidential election in 2027.