Mitigating Catastrophic Forgetting in Large Language Models with Self-Synthesized Rehearsal