Properly remove terminated thread from ready queue.

If we change the priority first, we'll remove from the wrong priority
level, oops.  Gotta change afterward.

Should improve Darkstalkers Chronicle: The Chaos Tower.
Merge pull request #5062 from unknownbrackets/thread-minor

Properly remove terminated threads from ready queue
Check EPMap and return ERROR_PSMF_NOT_FOUND if empty
Merge pull request #5063 from raven02/patch-18

Check EPMap and return ERROR_PSMF_NOT_FOUND if empty