Towards Context-Robust LLMs: A Gated Representation Fine-tuning Approach