The aerospace giant said it would temporarily lay off tens of thousands of employees to stem losses from a walkout by the machinists’ union.