Save scalars to a file, destructor