The meat giant will sell or end operations at three facilities and lay off at least 2,500 workers as the company struggles to overcome heavy losses.