Add different exit callbacks to terminal and main