Close f if its not stdout, from cppcheck