It seems as if the powers that be decided student safety was less important than apprehending any possible suspect...
If there is a gunman I think you would want students spread out among their classrooms. If there's a major panic there can be deaths from the panic not to mention the danger of a gunman in a hallway as students try to escape.