A judge of the juvenile court in which a petition was filed 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 person who is the subject of the petition require that dismissal, or if it finds that he or she is not in need of treatment or rehabilitation. The court has jurisdiction to order dismissal or setting aside of the findings and dismissal regardless of whether the person who is the subject of the petition is, at the time of the order, a ward or dependent child of the court. Nothing in this section shall be interpreted to require the court to maintain jurisdiction over a person who is the subject of a petition between the time the court's jurisdiction over that person terminates and the point at which his or her petition is dismissed.
Ca. Welf. and Inst. Code § 782