How Rebel Victories Stop Civil Wars While Foreign Intervention Prolongs Them