Add condition to generated file removal