Testing code updated.
Files now closed when pipes are bound to stdin and stdout.