An employer is legally entitled to recover any overpayment of wages, either during the currency of the contract of employment, as well as after the employee's contract has come to an end.
The general rule is that if an employer has overpaid an employee, the overpayment of wages should be repaid even if the mistake was the employer's.