Merge pull request #4434 from BrzVlad/fix-unload-hang