Check that _stdout_buffer or _stderr_buffer are not none

I was running into errors here because these values were None, so I added an extra check for that.