The first reason is connected to emergency. If a door went till the ground, other people in the toilet area and in other stalls would not be able to know if an occupant has lost consciousness or not. Hence, the gap provides visibility so that others can take note if a person is in distress.