Overall per unit cost of producing a good the plant is a primary factor. The marginal revenue produced by selling the plant's output minus the marginal cost of producing and selling the plant's output must be positive for the plant to be economically worthwhile to operate.
Plant production is based on sales demand and lead time. Lead time is the time it takes to produce a finished product. As long as there is more demand than product on hand, production continues. When production exceeds demand, excess inventory accumulates and production should be scaled back or stopped.
While the overall decision is not a simple one, a company should stop producing at a particular plant if it is no longer reasonably possible in the foreseeable future to make a profit from that production, once all of the associated expenses are taken into account.
A company will be able to decide this through looking over records which shows the production and the profit and see if the work is actually worth whats coming out of the business.