fix Issue 8960 - Unable to set thread priority

- ignore FreeBSD error when get-/setting priority on terminated thread
- this also ignores invalid thread handles