The goal of a buying or selling closing order is for the order to be placed as close to the closing time and price for the day. A closing order can refer to many different meanings, but most commonly the term is used for closing the position of the investor.
For example, any order to square off a long or short option position. If a call option is sold then the seller will place an order to buy back the sold call option with a buy-to-close order. The trader who has purchased the call option will place a sell-to-close order to execute the opposite trade to close his position.