Merge some bugfixes for embedding shutdown
Bug 1001853 - Don't loop waiting on the monitor, and acccount for the fact that timeouts are treated as success. r=jgilbert