Finally, Jonathan's close-on-exit terminal recipe!