Status set to TERMINATED on error in C++