in reply to Re^2: Can't close STDIN/STDOUT/STDERR
in thread Can't close STDIN/STDOUT/STDERR

As ikegami has already toll you, reopen STDIN/STDOUT/STDERR to /dev/null.

Though, until you get your program working right, it would be probably better to redirect STDOUT/STDERR to some file you can read (i.e. /tmp/out).