Singular perturbation of a finite horizon problem with state-space constraints