There is nothing wrong with you taking the salary if the contract was cancelled by them, and there was no refusal to work or any shortcoming on your part. The basic principle in this case is that a work contract is binding, and that the employee is entitled to payment throughout the period agreed upon, even if he is not given any work to do or the employer has no need of him, so long as he is prepared to work and does not refuse to do so.
It says in al-Muqni’: Employment is a contract that is binding on both parties, and none of them has the right to cancel it, but if he wants to do so before the time is up, he is obliged to pay the wages. End quote.
It says in al-Sharh al-Kabeer (14/436): Employment is a binding contract which means that the employee must be given the wages and the employer must be given the work. If the employer cancels the contract before the period ends and does not demand the work, the contract is not annulled and he must pay the wages.
You should contact the ministry of education to see about renewing the contract and related matters.
And Allaah knows best.