fix Issue 8960 - Unable to set thread priority

- Ignore ESRCH error when get-/setting the priority of a terminated thread.

- This also ignores invalid thread handles, which shouldn't occur in a
  program without memory corruption.