Trying to close write ends of pipes but not working. Made some other tweaks. Hangs on waits so gotta fix that.