Capture the stack when invalidating channel/connection

Throwing an error on illegal operations is all well and good, but it
doesn't indicate why the operation is now illegal. Capturing the stack
at the time of the state transition (to, e.g., 'closed') will at least
show how it got there.
Put the captured traces closer to the cause