Added a print to std::cout after print to file and a close() to the file handler