in reply to execute a command using OPEN

That error originates from the shell as a result of wc being killed by SIGPIPE when it tries to write to its output handle after you closed it in your program.

If you were to actually read wc's output, you wouldn't have this problem.