Tidy up memory handling in WiredTiger async callbacks.