At the trial of a complaint or indictment for a violation of sections 609.341 to 609.3451; 609.3453; 609.3458; 617.246, subdivision 2; or Minnesota Statutes 2004, section 609.109, when a minor under 18 years of age is the person upon, with, or against whom the crime is alleged to have been committed, the judge may exclude the public from the courtroom during the victim’s testimony or during all or part of the remainder of the trial upon a showing that closure is necessary to protect a witness or ensure fairness in the trial. The judge shall give the prosecutor, defendant and members of the public the opportunity to object to the closure before a closure order. The judge shall specify the reasons for closure in an order closing all or part of the trial. Upon closure the judge shall only admit persons who have a direct interest in the case.