Details
Description
When the MigrationManager schedules multiple concurrent migrations for the same namespace, the first migration to be scheduled will acquire the collection distributed lock and the last one to complete will release it.
Currently when the last scheduled migration completes, it signals the migration as complete to the caller before releasing the distributed lock, which causes a race condition where an immediately scheduled 'moveChunk' command fails because the lock is not released yet.
We should switch the order so that the last notification is signaled only after the distributed lock has been released.