Students shared pictures of themselves hiding in a classroom after they were advised to stay where they were until police arrested the gunman