What was the name of the treaty that ended the war?