If your employer breaches the agreement by terminating the worker right before it ends, it may be thought of wrongful termination. The terminated employee need to talk to a lawyer to debate their alternatives.
even https://jmllaw.com/areas-of-practice/employment-law/wrongful-termination.shtml