Fix race condition in n pdftotext child process stdout stream and exit event