Both teachers and students have different ideas about this topic. Teachers often have different opinion from students.
On the one hand, it would be good for the students to be allowed to get out of this school, at least during break time, as they do in some high schools. Being locked all morning at school is not good and we should get out and not be locked.
On the other hand, some children will not return because they do not study and they do not care the studies and the parents would complain to the high school.
To sum up, I believe that the gates should not be locked during the day, as a minimum for the Bachillerato's students because the Bachillerato is not compulsory education and each student should be responsible and do what they want to in the Bachillerato.