I’m pretty sure that most, if not all, candidates get to keep whatever money is left over from contributions if/when they bow out of the race.
This is why you see the overcrowding in the beginning from those who everyone knows doesn’t have a snowballs chance in hell of winning the nomination, much less the general election.
Candidates’ being able to use the money for their own personal use ended in 1989.
They first have to pay off all liabilities and then whatever is left can be used for future campaigns, including maintaining a staff or advisors in the meantime, or given to charity. (I imagine the Clinton Foundation benefitted in this way).