I'm no apr expert, but the docs at http://apr.apache.org/docs/apr/0.9/group__apr__library.html mention this:

    The APR developers suggest using atexit to ensure this is called.

I remember that apr_initialize() and apr_terminate() perform reference counting, which makes me think that we should call terminate as late as possible, to prevent forwarding this problem to other modules?