Teachers leaving before the end of working hours because there are no students present
If there is no work and the administration allows the teachers to leave, then there is no sin on you if you leave, because the administration is authorized to decide what is in the best interests of the work and to divide tasks among employees.
Shaykh Ibn Baaz (may Allaah have mercy on him) was asked about an employee who, when he has finished his work, leaves before working hours are over, especially during Ramadaan. Is that permissible?
He replied: It is not permissible, and he has to stay at work until the working hours are over, unless he has permission from his boss, because some new work may come up, and he may be needed. So the employee should stay at work until the working hours are over, unless he has permission from the state or from his boss. End quote from Fataawa Noor ‘ala al-Darb.
And Allaah knows best.