If I owe a friend $5,000, and I have been saving up this money in a safe place, but one day someone steals all the money I have saved up so far ($3,000), and we did not catch the thief. I tried giving my friend the $3,000, but he told me to hold on to it until I have all the money I owe him. How much money should I pay my friend?
You still owe your friend $5,000.
The fact that you held on to the money doesn’t make you means that you didn’t yet pay off any of the debt, and you remain obligated.
Although you lost the money due to theft after he asked you to hold on to it, you were at the end of the day holding onto your own money, and he is not liable for the loss.