Imbalances began to be published because of abuses in the 1980s. For example, if XYZ Brokerage Firm knew that it had S&P 500 stocks to buy at the end of the day, they used to go down to the floor and put sell orders in size for the S&P 500 stocks. The crowd would see this and the market got hit. In the meantime XYZ Brokerage firm bought OEX call options and SPX call options. Near the close they would CANCEL their sell orders and put the proper buy orders in for market on close. Then of course, they did well with their options that the bought and the stocks went up. Specialists had a hard time finding the other side to the trade and they, for the most part, took the other side. Back then, specialist units were smaller partnerships and taking on these big positions over the weekend was not the best thing to do for a risk management basis.
This is how the "triple witching" expiration got named (major volatility!).
Now S&P 500 cash and futures are settled on the opening print as opposed to the closing print which helps out a lot.
These closing imbalances are published by the NYSE at 3:40 pm. Once this cut off is reached, you CANNOT cancel your market on close order. You are, however, allowed to enter an offsetting market on close order against the published imbalance after 3:40 pm. The NYSE publishes these imbalances to reduce volatility (in other words it is trying to find the other side to the trade).
Today, most of the closing imbalances are for S&P 500 index additions, deletions or rebalancing. Of course on June 30 of each year, you get the Russell rebalancing which can be a lot of fun.