LegacyUtils: avoid infinite loop in image disposal

When ImagePlus#close is called, it calls LegacyHooks#unregisterImage,
which in turn calls LegacyImageMap#unregisterLegacyImage, which calls
LegacyImageMap#removeMapping, which calls LegacyUtils#deleteImagePlus,
which was calling close again, resulting in a stack overflow.

It may cause other problems not to call close anymore from
LegacyUtils#deleteImagePlus, but at least they won't be as bad as a
stack overflow.