On expiration day, any time that the underlying is higher than the strike price of the call or lower than the strike price of the put then it is ITM. When that happens, it is possible that the option owner exercises intraday.
As an aside, American options are exercised early if:
- They are ITM and the bid trades at a discount to the intrinsic value and
- There is a pending dividend which offers an arbitrage.
To avoid this possible early assignment, you need to understand and recognize these situations.
It's improbable that you and the buyer are the counterparties when you BTC your short option. New contracts are created, contracts cease to exist (BTC + STC) and existing contracts change hands many, many times during their lifespan.
The market maker is always there, offering you the ability to buy or sell. You may not like his prices and you may have issues if you have a huge position but he is obligated to make a market and trade.