Merge pull request #3370 from ludovic-henry/fix-finalizer-wait