improve handler management

the asynchronous handler is stored when the change request is sent for a
database, so that is can then be properly stopped. This avoids having
many useless open connections and threads running when all change
handlers are unregistered.