If an investor buys a put option to protect their long position, but the seller closes the position before expiration (if it gets close to being in the money), does that eliminate the buyer's "insurance"? If so, then it wouldn't this risk invalidate the whole strategy of buying protective puts?
The original option writer (seller) can close his short position in the contracts he wrote by purchasing back matching contracts (i.e. contracts with the same terms: underlying, option type, strike price, expiration date) from any others who hold long positions, or else who write new matching contract instances.
Rather than buyer and seller settling directly, options are settled through a central options clearing house, being the Options Clearing Corporation for exchange-listed options in the U.S. See also Wikipedia - Clearing house (finance).
So, the original buyer of the put maintains his position (insurance) and the clearing process ensures he is matched up with somebody else holding a matching obligation, if he chooses to exercise his put.
I also answered a similar question but in more detail, here.
You're assuming options traded on the open market. To close open positions, a seller buys them back on the open market. If there's little on offer, this will drive the price up.
An option is freely tradable, and all options (of the same kind) are equal. If your position is 0 and you sell 1 option, your new position in that option is -1. If the counterparty to your trade buys or sells more options to close, open, or even reopen their position afterwards, that doesn't matter to your position at all.
Of course there's also the issue with American and European Options. European Options expire at their due date, but American Options expire at their due date or at any time before their due date if the holder decides they expire. With American Options, if a holder of an American Option decides to exercise the option, someone who is short the same option will be assigned as the counterparty (this is usually random). Expiry is after market close, so if one of your short American Options expires early, you will need to reopen the position the next day. Keep in mind dividends for slightly increased complexity.
American and European Options do not in any way refer to the continents they are traded on, or to the location of the companies. These terms simply describe the expiry rules.
The entity on the other side of the trade is selling the put option. This could mean they are either an account that has +1 of that put option and is looking to sell it (-1). Or, they are someone looking to open up a position by selling a put (much like the trader originally did).
In both cases, the end result is that the original trader gets credited that option back and their position is nullified. If the entity on the other side was a person that was holding a put (+1), they are selling it (-1) for that price, and the open interest will decrease. If the entity on the other side is establishing a new position, the open interest remains the same and the entity on the other side takes on the role of fulfilling that option on the expiration date.
Note that it doesn't matter if the entity on the other side of the trade was the original party that made the original trade happen. The responsibility for fulfilling the contract will either pass to a new person (new seller), or dissolve (same buyer). There will always be a matching pair of buyer/seller for each contract.