Optimal Balancing of Time-Dependent Confounders for Marginal Structural Models