runtime: make TestStackMem a little less flaky

Have seen failures with GOMAXPROCS=4 on Windows.

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/7626043
runtime: clear locked bit when goroutine exits

Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.

While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.

Fixes issue 4971.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://codereview.appspot.com/7627043