24. A person shall cease to be under close treatment when:(a) he is discharged by the institution where he is being kept on the recommendation of a psychiatrist by a certificate issued by the latter for that purpose;
(b) his discharge is ordered by a final judgment of a competent court or by the decision of the Administrative Tribunal of Québec.