Local frustration determines loop opening during the catalytic cycle of an oxidoreductase