The midterm elections ended in cliffhangers in several battleground states, with control of the Senate and the House still undetermined.