A judge of the juvenile court in which a petition was filed, at any time before the minor reaches the age of 21 years, may dismiss the petition or may set aside the findings and dismiss the petition if the court finds that the interests of justice and the welfare of the minor require the dismissal, and that the parent or guardian of the minor is not in need of treatment or rehabilitation.
Ca. Welf. and Inst. Code § 390