Adjustment of the gap between the foaming mold and the shaping mold