Fix handling of stdout and stderr files.