Sunk-Cost Effects Made Ancient Societies Vulnerable to Collapse