Yes. Unused themes can still have security holes, even when they’re inactive. Keep your active theme and one default WordPress theme (like Twenty Twenty-Five) as a backup, and delete the rest.