Add hooks to the pool database to make it easier to detect and remove
closed connections, refs #444