Controlling process instability for defect lean metal additive manufacturing