Effects of Finite Length on the Electronic Structure of Carbon Nanotubes