Short of making `.removeMarkedExtensions` also call `.dispose`, I don't think it gets much better than this right now.

You actually don't *have* to call dispose in either of the cases after `removeMarkedExtensions`, because it's just going to quit anyhow. But, personally, I'd leave it as it is.