Fix run cleanup if the UI ends without clearing non-Hooke msgs from the Queue.
If the UI closes before the last command finishes (e.g. if bin/hooke
is run in a pipe), there may be cruft (e.g. CommandExit instances)
left in the engine-to-UI queue before the Hooke instance that the
CommandEngine appends on closing. The new implementation keeps
digging through the queue until it finds a Hooke instance, where the
old implementation only looked at the first message that came off the
queue.
Also added some useful debugging logs for UI<->Engine communication.