Explicitly close ofstream when dumping particles.