Closed geodesics on compact Lorentzian manifolds of splitting type