This was one of those bugs: calling printf() after fd 1 is closed.