What are those hatches on the engines of a B-2 that are open during takeoff?
These are secondary intake doors which allow more air to reach the engines. They are opened by the engine control computer when the main intakes are not providing enough air for the power setting of the engine. In order to minimize radar cross section, the engines of the B-2 are buried in the wings and the intake needs to be curved. Also, and for the same reason, the intake lips need to be sharp-edged. Both factors increase the drag of the intake flow and reduce the mass flow of air to the engines. Like on other low-RCS aircraft, secondary intake openings are needed to increase this mass flow.

In automatic mode they will close when the aircraft accelerates above Mach 0.4. Below 43F, they remain closed for taxi and are only opened for take-off. A take-off with closed doors is possible according to this thread, but needs a reduced power setting to 80% for the engines below 50 kt speed.