Avoid a race condition where media is closed because we get the video track too soon (cherry picked from commit 9f549861)