kernel - Fix issue revealed by new yield code

* Make sure the current lwp is released from the scheduler in all cases.
  There were a few race cases where it would not be released.

* Reorder the yield code a little.