When a market is oversupplied in such a manner, corporations owned by the gamemaster (in the form of corporations owned by C3s) generally tend close in response. The oversupply is the cause and the closing is the effect rather than the other way around.
I observed this when I built a ton of spice corporations (I built way past the amount needed to produce for the entire world market). Other spice corporations decreased rapidly to the point where it was apparent that the corporations remaining were all owned by players: the reason for this conclusion is that player owned corporations will not automatically close from debt. Instead, they will continue leeching money from the parent country/enterprise until kingdom come or the player manually closes them. As far as I know, gamemaster corporations do not behave this way.
It is important to note that if the corporation in question is "making an attempt" to sell its products, meaning a player hasn't specifically ordered the corporation NOT to sell it's good, then the goods will generally be sold within 6 months (I believe the system just tries to get rid of them at "clearance rates" at this point)... meaning the corporation usually won't be overstocked anywhere approaching those numbers. There should be a game news referencing this system, not sure how old it is.
This is an opinion, but it seems as though many "small market" products - those products which a small percentage of the total number of corporations on the planet are needed to supply the world economy - are prioritized by the automatic system of C3 countries... presumably in order to prevent the market from shorting in any of these sectors from player neglect.
I don't know what you mean by ex-post, but I figure the way it works is that market price is determined for the month based on whether the previous month had a surplus or shortage. I believe there may be some maximum and or minimum (if not an outright set ratio of base price and/or current price that it changes according to). I haven't observed anything that leads me to believe it is more than a simple check to see whether it moves up or down - even if the amount it moves up and down may be based on other factors. Anyway, for sure there is a maximum ratio that market price can change by to prevent massive changes in price occurring over a game month. Of course, this is speculation and may prove to be inaccurate. If you figure this is worth investigating, more power to you.
Generally speaking, it is not a good idea to buy products then sell to the market as per what Super noted. The minimum purchase quality is 120 and selling from the country/enterprise stock to the market ignores these quality effects. Meaning you'd need to make up the 20 quality points with the higher sale price and then some. Additionally, "flooding" the market is not good because the market price falls relatively quickly in comparison to the the rate at which the products will generally sell in a "flooded" market. Of course larger markets are more or less immune from these effects unless you dedicate trillions upon trillions to getting a stockpile that can realistically "flood" the market.