(A) owns the shares and they are loaned to (B) who sells (shorts) them to (C). (A) owns the shares in book entry form but the actual shares are in street name at (C)'s broker.
There are no restrictions on (A). He can sell his shares at any time. When he does that, (A)'s broker requests that (B)'s broker return the shares.
(B)'s broker will then borrow the shares from another in house account that owns them. If no such shares exist, he will borrow them from another broker so that (B) can remain short. If the stock is hard to borrow and none can be found for borrowing, (B) will receive a forced buy-in notice and he will have until 4 PM EST to cover his short position.
It's preferable to work the order yourself when closing the short position. You do not want the broker doing so because his buy-to-close will be done during after hours trading when B/A spreads often widen significantly.