I think there is a tidy up routine or something similar (please somebody correct me if I'm talking out my behind) that should clear up the unused resources on a schedule.
Otherwise there are utilities out there that can help identify and clear up any missing resources (Joplin Vacuum - A Python script to remove orphaned resources)