Solves a race condition when deleting a stream, as the fd might get closed just as another thread tries to read from it, leading to EBADF read error. Change-Id: I8ea3ff72c2788ce3051a86a0bbd1650b03965376 (cherry picked from commit 64eba103e3)
64eba103e3