Fix race condition between EndOfStream and Pause.