Close stdout/stderr file handles explicitly