Fix JS error when adding new media

So glad so see that "closest" code gone - good job.