Should not call std::exit() in the middle of program

Calling std::exit() in the middle of a C++ program subverts stack unwinding and can introduce subtle bugs. Debug heap reports numerous memory leaks because of this.