fix bug in collector.completefile(), file rename should be done immediately