Section 38. All hearings under sections one to thirty-seven, inclusive, shall be closed to the general public and it shall be unlawful to publish the names of persons before the court in any hearing provided for therein, except under section twenty-one.