We study a multi-period mean-variance portfolio selection problem with an uncertain time horizon and serial correlations. Firstly, we embed the nonseparable multi-period optimization problem into a separable quadratic optimization problem with uncertain exit time by employing the embedding technique of Li and Ng (2000). Then we convert the later into an optimization problem with deterministic exit time. Finally, using the dynamic programming approach, we explicitly derive the optimal strategy and the efficient frontier for the dynamic mean-variance optimization problem. A numerical example with AR(1) return process is also presented, which shows that both the uncertainty of exit time and the serial correlations of returns have significant impacts on the optimal strategy and the efficient frontier.