Plasma optical shutter in ultraintense laser-foil interaction