Test-Time Training Provably Improves Transformers as In-context Learners