12. Confinement ends, with no further formality,
(1) as soon as a certificate attesting that confinement is no longer justified has been issued by the attending physician or a specialized nurse practitioner;
(2) on the expiry of a time limit prescribed by section 10, if no psychiatric examination report has been produced by that time;
(3) on the expiry of the time fixed in the judgment ordering confinement;
(4) upon a decision to that effect by the Administrative Tribunal of Québec or a court of justice.