address race condition between process exiting and consuming stderr

drains stderr after we know the process ended