bfd_close_all_done calling _close_and_cleanup
elf64_vms_close_and_cleanup calls bfd_get_size, which calls
iovec->bstat. cache_bstat ends up adding the bfd to the cache lru
list, negating the bfd_cache_close call in bfd_close_all_done. So
there is a dangling pointer into the freed and then reused bfd. Thus,
bfd_cache_close must be called after _close_and_cleanup, or better,
via iovec->bclose.
PR binutils/22032
* opncls.c (bfd_close_all_done): Don't call bfd_cache_close
before _close_and_cleanup. Call iovec->bclose after.
(bfd_close): Remove code common to, and call, bfd_close_all_done.