Search backend: fix race condition with new streams
Created by: camdencheek
This fixes an issue where we are writing to a stream before cleaning up other parallel writers.
Test plan
Briefly tested manually and saw no races. Will add a better test to exercise this with the race detector after I fix main.