Nadal on the up again, Ferrer ends career in Madrid