Fire door lock. Surely the schools you went to had doors with automatic closure arms (located at top on hinge side) and a “quick-opening bar” running across the whole door around waist height that when depressed unlatches the door (inside only...cannot be opened from outside). If the closure arm doesn’t exert enough pressure, the door might not re-latch. A slight manual pull will force the door to re-latch.
There were no alarms on any doors when I went to school. The main doors had a kind of bar, but not all of the side doors. Those however were not for student use.