added checks so test case files will also be retained if any stderr output is generated