Fix issues found with valgrind

Had some uninitialised memory and unclosed file pointers in src/wc.c.

There were also some issues with getpwuid and getgruid reported in
src/ls.c, but Googling seems to indicate those are false positives due
to the glibc implementation using an area of static memory for the
return values (i.e. the leak doesn't grow with repeated calls).