The folding cooperativity of a protein is controlled by its chain topology