Add stopApp function, for returning a value from runApp