make sure pause_on_exit is honored even when errors happen