Which war resulted in territorial gains for the United States that caused sectional conflict in the years leading up to the Civil War?