Attempt to fix the case when we hit EBADF.