Section 23. Excluding the Public. — When a child testifies, the court may order the exclusion from the courtroom of all persons, including members of the press, who do not have a direct interest in the case. Such an order may be made to protect the right to privacy of the child or if the court determines on the record that requiring the child to testify in open court would cause psychological harm to him, hinder the ascertainment of truth, or result in his inability to effectively communicate due to embarrassment, fear, or timidity. In making its order, the court shall consider the developmental level of the child, the nature of the crime, the nature of his testimony regarding the crime, his relationship to the accused and to persons attending the trial, his desires, and the interests of his parents or legal guardian. The court may, motu proprio, exclude the public from the courtroom if the evidence to be produced during trial is of such character as to be offensive to decency or public morals. The court may also, on motion of the accused, exclude the public from trial, except court personnel and the counsel of the parties.