The answer depends on the agreement between the lender and the borrower.
Suppose that I loan you my car and then decide to sell it. One possibility is that my agreement with you doesn't let me sell it (or forces me to come up with another car for you if I do). Another possibility is that my agreement with you says that the loan to you ends if I decide to sell.
Short selling is a form of borrowing. The only odd thing is that the thing that you have to repay isn't cash.
Consider a mortgage. The borrower rarely has enough money to cover the whole loan when it is taken out. Instead, the borrower hopes to have enough money to cover each payment as it occurs.