AdaGC: Improving Training Stability for Large Language Model Pretraining