Association of prior criminal charges and convictions with subsequent violent and firearm-related crime: a retrospective cohort study