Question says it all, if I exercise an option mid day, is the closing price used to fill the order? In other words, exercise does not lock the price, correct?
It sounds like you want to know the specifics of assignment once an equity option is exercised, and this is really a 'check with your broker' question.
Your broker will have a cut-off time to exercise a contact. If you exercise during that day the security will settle on your account after the normal stock settlement period - i.e. as if you had purchased the security on market, something like T+2 (not to be confused with options settlement which is generally T+1). So, it doesn't matter when on a day you exercise, the security will still settle on your account on the same morning.
Most brokers will allow you to sell some or all of the assigned stock before the settlement date and lock in a return (e.g. at the same time as you exercise the call option, you sell an equal quantity of the underlying security on-market). This will generally mean you don't need to provide funding on the settlement date.
You can reverse the above logic for a put option.
Your question is about a situation that never occurs.
In the USA, individual stock options are American and exercised via delivery of the stock (with no consideration of its price at some time t). When you exercise an American call you pay the amount K and you receive the stock. That's it, that's all there is to Exercising. If you wish you can (simultaneously or later, or never, it is up to you) sell the stock and receive $S_t$ where t is the time you decide to sell, say 10:45am on the 12th of December. Then you will have made $S_t-K$.
Cash settled options are a different kettle of fish. CBOE index options are exercised via cash settlement (no delivery) with reference to the official exchange closing index price BUT THESE OPTIONS ARE EUROPEAN EXERCISE, the exercise takes place at the moment of expiration, according to the formula $(S_t-K)^+$ using the same official settlement price $S_t$ for everyone.
In summary then, it is a design issue. If the exchange wants to create an American option they must provide some tradeable instrument (stock, future) which will be physically delivered. If they wish to create a European option they can have physical delivery or cash settlement with respect to an officially determined closing (or sometimes opening) price. There are no other ways to do things AFAIK.