Add `--auto_close` option
5.0.x: use a structured annotation for auto-close
5.0.x: add public handle field
Better error handling
auto-close integration test
Move NSAUTOCLOSE detection earlier

During cleanup, the transaction has already exited and
therefore there's no way to properly query some types
of annotation (e.g. those which are unloaded). Instead,
we check earlier for the appropriate annotation and only
re-act during autoClose().

Note: throwing exceptiongs from `getResponse()` is a *bad*
      idea.
More null checks in detectAutoClose
And even more null checks
Fix import errors post-rebase
Merge pull request #2799 from joshmoore/rebased/develop/auto-close

Auto close (rebased onto develop)