[FIXED JENKINS-16412] Don't use the module name for cleanup if flatten
is true