The inlets are closed in order to avoid FOD (Foreign Object Damage) when taking off from unprepared fields. When the main inlets close, two other inlets open above the fuselage, as visible in the following photograph (source):
I think that this solution was imposed by the compactness of the airframe and the proximity of the front landing gear to the inlets, which worsen FOD ingestion.
As pointed out by Peter Kämpf, MiG-29 was the first fighter to employ this double inlets system.
Apparently the twin design M-346 by Aermacchi (now Leonardo) doesn't possess this kind of feature (source):