trying to fclose(NULL) crashes in linux (at least in ubuntu)