Protein structures often feature beta-sheets in which adjacent beta-strands have large sequence separation. How the folding process orchestrates the formation and correct arrangement of these strands is not comprehensively understood. Particularly challenging are proteins in which beta-strands at the N and C termini are neighbors in a beta-sheet. The N-terminal beta-strand is synthesized early on, but it can not bind to the C terminus before the chain is fully synthesized. During this time, there is a danger that the beta-strand at the N terminus interacts with nearby molecules, leading to potentially harmful aggregates of incompletely folded proteins. Simulations of the C-terminal fragment of Top7 show that this risk of misfolding and aggregation can be avoided by a "caching" mechanism that relies on the "chameleon" behavior of certain segments.