Close stderr file before reading it