Fix race condition in PromiseStream.take that can cause the stream to complete prematurely