close stdout after killing proc to avoid concurrency excpetion