The incident occurred when middle school students touched a metal railing while waiting in line for a ride, according to officials