Reorder closing message channel.

For every daemon always close the message channel before starting
the cleanup of the JCR so we have a much cleaner code path.

Also tweaked the layout of the code somewhat so that we have more
distinctive code blocks.