End effects in capacity expansion models with finite horizons