Learning-Based Optimal Control Of Time-Varying Linear Systems Over Large Time Intervals