Rafael Nadal officially ended his career at the Davis Cup Finals as Spain lost their quarter-final tie.