V-ている / N + の + 間(に)
while ~ / during ~
間 alone means the action fills the whole period. 間に means something happened at one point inside it. 留守の間に means someone came while you were out — a moment, not a duration. The に is the whole difference.
赤ちゃんが寝ている間に、掃除しました。
あかちゃんが ねて いる あいだに、そうじしました。
I cleaned while the baby was asleep.
夏休みの間、ずっと働きました。
なつやすみの あいだ、ずっと はたらきました。
I worked the whole summer holiday.