In any prosecution for perjury, it is an affirmative defense that the defendant retracted his false statement in the course of the proceeding in which it was made before such false statement substantially affected the proceeding and before it became manifest that its falsity was or would be exposed.
N.Y. Penal Law § 210.25