It is possible that both process exit event is called and cli.parse throws an exception, in this case the end/callback is called twice.
This is a way to ensure we call end() only once and I don't see this as a hack at all.