implement graceful cancellation of long-running CLI operations

also, stop any running CLI instances on preuninstall