Added file handle closes for output/err handles