A survey of historians shows that America was at its best when it was open to the world and engaged with it, and at its worst when it became closed.