Those girls cannot close the doors. That is discrimination. You are unaware and naive.
The doors on stalls in girls and women’s school and public bathrooms have locks on the inside. I can remember closing and locking stalls when I was six. Obviously your experience with female rest rooms is rather limited. From the little I’ve seen of male rest rooms, there is usually a long trough to pee in and a few stalls to do do in.