diff --git a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
index 6c1bc388153f37d746cbf8a173a5ecc85c7201d5..344a6139c88340fe96b6ef92bc49f9d5637615f1 100644
--- a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
+++ b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
@@ -231,6 +231,7 @@ object ReportBuilder {
       case Some(template) => template
       case _ =>
         val tempFile = File.createTempFile("ssp-template", new File(location).getName)
+        tempFile.deleteOnExit()
         IoUtils.copyStreamToFile(getClass.getResourceAsStream(location), tempFile)
         templateCache += location -> tempFile
         tempFile
diff --git a/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala b/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
index 960c4921debd6e58f45fa00bbb9dc0864dd11c60..62b04375f630ab59fea18d9c1d974bdf038cb767 100644
--- a/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
+++ b/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
@@ -625,6 +625,7 @@ object VcfStats extends ToolCommand {
   def executeRscript(resource: String, args: Array[String]): Unit = {
     val is = getClass.getResourceAsStream(resource)
     val file = File.createTempFile("script.", "." + resource)
+    file.deleteOnExit()
     val os = new FileOutputStream(file)
     org.apache.commons.io.IOUtils.copy(is, os)
     os.close()
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFastaTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFastaTest.scala
index ebe393bfab7bdb8fedec024319e99a5b0ec29a07..d9d8c1bee6bf96bcc98a372585b5a89454775e08 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFastaTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFastaTest.scala
@@ -31,6 +31,7 @@ class BastyGenerateFastaTest extends TestNGSuite with MockitoSugar with Matchers
 
   @Test def testMainVcf = {
     val tmp = File.createTempFile("basty_out", ".fa")
+    tmp.deleteOnExit()
     val tmppath = tmp.getAbsolutePath
     tmp.deleteOnExit()
 
@@ -40,6 +41,7 @@ class BastyGenerateFastaTest extends TestNGSuite with MockitoSugar with Matchers
 
   @Test def testMainVcfAndBam = {
     val tmp = File.createTempFile("basty_out", ".fa")
+    tmp.deleteOnExit()
     val tmppath = tmp.getAbsolutePath
     tmp.deleteOnExit()
 
@@ -49,6 +51,7 @@ class BastyGenerateFastaTest extends TestNGSuite with MockitoSugar with Matchers
 
   @Test def testMainVcfAndBamMore = {
     val tmp = File.createTempFile("basty_out", ".fa")
+    tmp.deleteOnExit()
     val tmppath = tmp.getAbsolutePath
     tmp.deleteOnExit()
 
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstatTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstatTest.scala
index 758cb6be6d6aa0a75c2ec1830e0fa3334beb7626..d919fe400154683f5fef7a061ce76c60aab5f5e7 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstatTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstatTest.scala
@@ -56,6 +56,7 @@ class BiopetFlagstatTest extends TestNGSuite with MockitoSugar with Matchers {
   def testMain() = {
     //TODO: Test output file
     val output = File.createTempFile("testMain", ".biopetflagstat")
+    output.deleteOnExit()
     main(Array("-I", bam.getAbsolutePath, "-o", output.toString))
   }
 
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FastqSplitterTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FastqSplitterTest.scala
index ffa8be0bcb6c2cf15bf0ad00efeeb54e903eb3df..dd66b204fab38a4fd26fb011ffe6739faf304009 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FastqSplitterTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FastqSplitterTest.scala
@@ -23,7 +23,7 @@ class FastqSplitterTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def testMain() = {
     val temp = File.createTempFile("out", ".fastq")
-
+    temp.deleteOnExit()
     val args = Array("-I", fq, "-o", temp.getAbsolutePath)
     main(args)
   }
@@ -31,6 +31,7 @@ class FastqSplitterTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def testManyOutMain() = {
     val files = (0 until 10).map(_ => File.createTempFile("out", ".fastq"))
+    files.foreach(_.deleteOnExit())
     var args = Array("-I", fq)
     files.foreach(x => args ++= Array("-o", x.getAbsolutePath))
     main(args)
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBioTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBioTest.scala
index b6de2f8bcca896e8979c2e21fc5bb8651524610a..907270b8c31f3eb152766f03a612101f754ba6c9 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBioTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBioTest.scala
@@ -29,6 +29,7 @@ class FindRepeatsPacBioTest extends TestNGSuite with MockitoSugar with Matchers
   def testMain() = {
 
     val outputFile = File.createTempFile("repeats", ".tsv")
+    outputFile.deleteOnExit()
     val args = Array("-I", bam, "-b", bed, "-o", outputFile.toString)
     main(args)
   }
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/MpileupToVcfTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/MpileupToVcfTest.scala
index 032f9a913373c0f3be617e45cc26a928ca69821d..e708bc654b3c81699dcab85bfc07a7e21cd3ea94 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/MpileupToVcfTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/MpileupToVcfTest.scala
@@ -28,6 +28,7 @@ class MpileupToVcfTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def testMain() = {
     val tmp = File.createTempFile("mpileup", ".vcf")
+    tmp.deleteOnExit()
     val args = Array("-I", pileup, "--sample", "test", "-o", tmp.getAbsolutePath)
 
     main(args)
@@ -36,6 +37,7 @@ class MpileupToVcfTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def validateOutVcf() = {
     val tmp = File.createTempFile("mpileup", ".vcf")
+    tmp.deleteOnExit()
     val args = Array("-I", pileup, "--sample", "test", "-o", tmp.getAbsolutePath, "--minDP", "1", "--minAP", "1")
     main(args)
 
@@ -51,6 +53,7 @@ class MpileupToVcfTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def extraValidateOutVcf() = {
     val tmp = File.createTempFile("mpileup", ".vcf")
+    tmp.deleteOnExit()
     val args = Array("-I", pileup, "--sample", "test", "-o", tmp.getAbsolutePath, "--minDP", "1", "--minAP", "1")
     main(args)
 
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/PrefixFastqTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/PrefixFastqTest.scala
index 41db9e3ae268a62860fd3fbe9a27e4430165429e..611557d836636aebc71f90e70707035033df6b97 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/PrefixFastqTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/PrefixFastqTest.scala
@@ -26,6 +26,7 @@ class PrefixFastqTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def testMain() = {
     val temp = File.createTempFile("out", ".fastq")
+    temp.deleteOnExit()
 
     val args = Array("-i", fq, "-o", temp.getAbsolutePath, "-s", "AAA")
     main(args)
@@ -34,6 +35,7 @@ class PrefixFastqTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def testOutput() = {
     val temp = File.createTempFile("out", ".fastq")
+    temp.deleteOnExit()
 
     val args = Array("-i", fq, "-o", temp.getAbsolutePath, "-s", "AAA")
     main(args)
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCountFastqTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCountFastqTest.scala
index 15d3074c95313c6f2a084c41b4d0a4787bdedddb..5c7731c6dd2ec60b7c8cd01f84c6929026d7e007 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCountFastqTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCountFastqTest.scala
@@ -22,6 +22,7 @@ class SageCountFastqTest extends TestNGSuite with MockitoSugar with Matchers {
   @Test
   def testMain() = {
     val temp = File.createTempFile("out", ".fastq")
+    temp.deleteOnExit()
 
     val args = Array("-I", fq, "-o", temp.getAbsolutePath)
     main(args)
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateLibaryTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateLibaryTest.scala
index 48038ea6f476fd89a945f53cf3d3608661fbcc9c..c86c1ba5a9787c0cdcce00293309500d6f6e4b86 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateLibaryTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateLibaryTest.scala
@@ -29,9 +29,13 @@ class SageCreateLibaryTest extends TestNGSuite with MockitoSugar with Matchers {
 
     val input = resourcePath("/mini.transcriptome.fa")
     val output = File.createTempFile("sageCreateLibrary", ".tsv")
+    output.deleteOnExit()
     val noTagsOutput = File.createTempFile("sageCreateLibrary", ".tsv")
+    noTagsOutput.deleteOnExit()
     val antiTagsOutput = File.createTempFile("sageCreateLibrary", ".tsv")
+    antiTagsOutput.deleteOnExit()
     val allGenesOutput = File.createTempFile("sageCreateLibrary", ".tsv")
+    allGenesOutput.deleteOnExit()
 
     val args = Array("-I", input, "-o", output.getAbsolutePath, "--tag", "CATG",
       "--length", "17", "--noTagsOutput", noTagsOutput.getAbsolutePath, "--noAntiTagsOutput",
@@ -52,9 +56,13 @@ class SageCreateLibaryTest extends TestNGSuite with MockitoSugar with Matchers {
   def testOutPut = {
     val input = resourcePath("/mini.transcriptome.fa")
     val output = File.createTempFile("sageCreateLibrary", ".tsv")
+    output.deleteOnExit()
     val noTagsOutput = File.createTempFile("sageCreateLibrary", ".tsv")
+    noTagsOutput.deleteOnExit()
     val antiTagsOutput = File.createTempFile("sageCreateLibrary", ".tsv")
+    antiTagsOutput.deleteOnExit()
     val allGenesOutput = File.createTempFile("sageCreateLibrary", ".tsv")
+    allGenesOutput.deleteOnExit()
 
     val args = Array("-I", input, "-o", output.getAbsolutePath, "--tag", "CATG",
       "--length", "17", "--noTagsOutput", noTagsOutput.getAbsolutePath, "--noAntiTagsOutput",
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateTagCountsTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateTagCountsTest.scala
index b47c507856ec251878057a3823d47d57160045e9..ecd1dae87d5c43a88e722cbb12f7eb18ece3a9b8 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateTagCountsTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SageCreateTagCountsTest.scala
@@ -26,9 +26,13 @@ class SageCreateTagCountsTest extends TestNGSuite with MockitoSugar with Matcher
     val tagLib = resourcePath("/sageTest.tsv")
 
     val sense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    sense.deleteOnExit()
     val allSense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    allSense.deleteOnExit()
     val antiSense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    antiSense.deleteOnExit()
     val allAntiSense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    allAntiSense.deleteOnExit()
 
     noException should be thrownBy main(Array("-I", input, "--tagLib", tagLib,
       "--countSense", sense.getAbsolutePath, "--countAllSense", allSense.getAbsolutePath,
@@ -50,9 +54,13 @@ class SageCreateTagCountsTest extends TestNGSuite with MockitoSugar with Matcher
     val tagLib = resourcePath("/sageTest.tsv")
 
     val sense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    sense.deleteOnExit()
     val allSense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    allSense.deleteOnExit()
     val antiSense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    antiSense.deleteOnExit()
     val allAntiSense = File.createTempFile("SageCreateTagCountsTEst", ".tsv")
+    allAntiSense.deleteOnExit()
 
     main(Array("-I", input, "--tagLib", tagLib, "--countSense", sense.getAbsolutePath,
       "--countAllSense", allSense.getAbsolutePath, "--countAntiSense", antiSense.getAbsolutePath,
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala
index 9866ad47a8efbfad5f34868b82fe415f6e6b8c28..e8a09a9d7cb9af569f2084c95a1b6c2e7f1e1aad 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala
@@ -21,6 +21,7 @@ class SamplesTsvToJsonTest extends TestNGSuite with MockitoSugar with Matchers {
   def testCorrectSampleTsv = {
     val tsv = resourcePath("/sample.tsv")
     val output = File.createTempFile("testCorrectSampleTsv", ".json")
+    output.deleteOnExit()
 
     noException should be thrownBy main(Array("-i", tsv, "-o", output.toString))
   }
@@ -29,6 +30,7 @@ class SamplesTsvToJsonTest extends TestNGSuite with MockitoSugar with Matchers {
   def testNoSampleColumn() = {
     val tsv = resourcePath("/no_sample.tsv")
     val output = File.createTempFile("testNoSampleColumn", ".json")
+    output.deleteOnExit()
     val thrown = the[IllegalStateException] thrownBy main(Array("-i", tsv, "-o", output.toString))
     thrown.getMessage should equal("Sample column does not exist in: " + tsv)
   }
@@ -37,6 +39,7 @@ class SamplesTsvToJsonTest extends TestNGSuite with MockitoSugar with Matchers {
   def testNumberInLibs = {
     val tsv = resourcePath("/number.tsv")
     val output = File.createTempFile("testNumberInLibs", ".json")
+    output.deleteOnExit()
     val thrown = the[IllegalStateException] thrownBy main(Array("-i", tsv, "-o", output.toString))
     thrown.getMessage should equal("Sample or library may not start with a number")
   }
@@ -45,6 +48,7 @@ class SamplesTsvToJsonTest extends TestNGSuite with MockitoSugar with Matchers {
   def testSampleIDs = {
     val tsv = resourcePath("/same.tsv")
     val output = File.createTempFile("testSampleIDs", ".json")
+    output.deleteOnExit()
     val thrown = the[IllegalStateException] thrownBy main(Array("-i", tsv, "-o", output.toString))
     thrown.getMessage should equal("Combination of Sample_ID_1 and Lib_ID_1 is found multiple times")
 
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SummaryToTsvTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SummaryToTsvTest.scala
index 6071fceaaed85a943a4f973ac713d24e8b708952..4f921affbc090031b83c0ee5fea3c64b9c9bdf4c 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SummaryToTsvTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/SummaryToTsvTest.scala
@@ -24,6 +24,7 @@ class SummaryToTsvTest extends TestNGSuite with MockitoSugar with Matchers {
   def testMain = {
     val tsv = resourcePath("/test.summary.json")
     val output = File.createTempFile("main", "tsv")
+    output.deleteOnExit()
 
     noException should be thrownBy main(Array("-s", tsv, "-p", "something=flexiprep:settings:skip_trim",
       "-m", "root", "-o", output.toString))
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
index af8ff6267d5c73dad9eaa10762b1d356a2641626..a6a70881012480a8e92b9aac1c689e4456f9f8c7 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
@@ -47,50 +47,57 @@ class VcfWithVcfTest extends TestNGSuite with MockitoSugar with Matchers {
   val rand = new Random()
 
   @Test def testOutputTypeVcf() = {
-    val tmpPath = File.createTempFile("VcfWithVcf_", ".vcf").getAbsolutePath
-    val arguments = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpPath, "-f", "CSQ")
+    val tmpFile = File.createTempFile("VcfWithVcf_", ".vcf")
+    tmpFile.deleteOnExit()
+    val arguments = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ")
     main(arguments)
   }
 
   @Test def testOutputTypeVcfGz() = {
-    val tmpPath = File.createTempFile("VcfWithVcf_", ".vcf.gz").getAbsolutePath
-    val arguments = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpPath, "-f", "CSQ")
+    val tmpFile = File.createTempFile("VcfWithVcf_", ".vcf.gz")
+    tmpFile.deleteOnExit()
+    val arguments = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ")
     main(arguments)
   }
 
   @Test def testOutputTypeBcf() = {
-    val tmpPath = File.createTempFile("VcfWithVcf_", ".bcf").getAbsolutePath
-    val arguments = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpPath, "-f", "CSQ")
+    val tmpFile = File.createTempFile("VcfWithVcf_", ".bcf")
+    tmpFile.deleteOnExit()
+    val arguments = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ")
     main(arguments)
   }
 
   @Test def testOutputFieldException = {
-    val tmpPath = File.createTempFile("VCFWithVCf", ".vcf").getAbsolutePath
-    val args = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpPath, "-f", "CSQ:AC")
+    val tmpFile = File.createTempFile("VCFWithVCf", ".vcf")
+    tmpFile.deleteOnExit()
+    val args = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ:AC")
     an[IllegalArgumentException] should be thrownBy main(args)
     val thrown = the[IllegalArgumentException] thrownBy main(args)
     thrown.getMessage should equal("Field 'AC' already exists in input vcf")
   }
 
   @Test def testInputFieldException = {
-    val tmpPath = File.createTempFile("VCFWithVCf", ".vcf").getAbsolutePath
-    val args = Array("-I", unveppedPath, "-s", unveppedPath, "-o", tmpPath, "-f", "CSQ:NEW_CSQ")
+    val tmpFile = File.createTempFile("VCFWithVCf", ".vcf")
+    tmpFile.deleteOnExit()
+    val args = Array("-I", unveppedPath, "-s", unveppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ:NEW_CSQ")
     an[IllegalArgumentException] should be thrownBy main(args)
     val thrown = the[IllegalArgumentException] thrownBy main(args)
     thrown.getMessage should equal("Field 'CSQ' does not exist in secondary vcf")
   }
 
   @Test def testMinMethodException = {
-    val tmpPath = File.createTempFile("VcfWithVcf_", ".vcf").getAbsolutePath
-    val args = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpPath, "-f", "CSQ:CSQ:min")
+    val tmpFile = File.createTempFile("VcfWithVcf_", ".vcf")
+    tmpFile.deleteOnExit()
+    val args = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ:CSQ:min")
     an[IllegalArgumentException] should be thrownBy main(args)
     val thrown = the[IllegalArgumentException] thrownBy main(args)
     thrown.getMessage should equal("Type of field CSQ is not numeric")
   }
 
   @Test def testMaxMethodException = {
-    val tmpPath = File.createTempFile("VcfWithVcf_", ".vcf").getAbsolutePath
-    val args = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpPath, "-f", "CSQ:CSQ:max")
+    val tmpFile = File.createTempFile("VcfWithVcf_", ".vcf")
+    tmpFile.deleteOnExit()
+    val args = Array("-I", unveppedPath, "-s", veppedPath, "-o", tmpFile.getAbsolutePath, "-f", "CSQ:CSQ:max")
     an[IllegalArgumentException] should be thrownBy main(args)
     val thrown = the[IllegalArgumentException] thrownBy main(args)
     thrown.getMessage should equal("Type of field CSQ is not numeric")
diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VepNormalizerTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VepNormalizerTest.scala
index 5a12e9b579296b58a2764fdaa0b5b916717e384f..53aeddfaf1d6ba87f9e89ac29b31edff8fc5e01b 100644
--- a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VepNormalizerTest.scala
+++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VepNormalizerTest.scala
@@ -47,38 +47,44 @@ class VepNormalizerTest extends TestNGSuite with MockitoSugar with Matchers {
   val rand = new Random()
 
   @Test def testGzOutputExplode(): Unit = {
-    val tmpPath = File.createTempFile("VepNormalizer_", ".vcf.gz").getAbsolutePath
-    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpPath, "-m", "explode")
+    val tmpFile = File.createTempFile("VepNormalizer_", ".vcf.gz")
+    tmpFile.deleteOnExit()
+    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpFile.getAbsolutePath, "-m", "explode")
     main(arguments)
   }
 
   @Test def testVcfOutputExplode(): Unit = {
-    val tmpPath = File.createTempFile("VepNormalizer_", ".vcf").getAbsolutePath
-    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpPath, "-m", "explode")
+    val tmpFile = File.createTempFile("VepNormalizer_", ".vcf")
+    tmpFile.deleteOnExit()
+    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpFile.getAbsolutePath, "-m", "explode")
     main(arguments)
   }
 
   @Test def testBcfOutputExplode(): Unit = {
-    val tmp_path = File.createTempFile("VepNormalizer_", ".bcf").getAbsolutePath
-    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmp_path, "-m", "explode")
+    val tmpFile = File.createTempFile("VepNormalizer_", ".bcf")
+    tmpFile.deleteOnExit()
+    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpFile.getAbsolutePath, "-m", "explode")
     main(arguments)
   }
 
   @Test def testGzOutputStandard(): Unit = {
-    val tmp_path = File.createTempFile("VepNormalizer_", ".vcf.gz").getAbsolutePath
-    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmp_path, "-m", "standard")
+    val tmpFile = File.createTempFile("VepNormalizer_", ".vcf.gz")
+    tmpFile.deleteOnExit()
+    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpFile.getAbsolutePath, "-m", "standard")
     main(arguments)
   }
 
   @Test def testVcfOutputStandard(): Unit = {
-    val tmp_path = File.createTempFile("VepNormalizer_", ".vcf").getAbsolutePath
-    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmp_path, "-m", "standard")
+    val tmpFile = File.createTempFile("VepNormalizer_", ".vcf")
+    tmpFile.deleteOnExit()
+    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpFile.getAbsolutePath, "-m", "standard")
     main(arguments)
   }
 
   @Test def testBcfOutputStandard(): Unit = {
-    val tmp_path = File.createTempFile("VepNormalizer_", ".bcf").getAbsolutePath
-    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmp_path, "-m", "standard")
+    val tmpFile = File.createTempFile("VepNormalizer_", ".bcf")
+    tmpFile.deleteOnExit()
+    val arguments: Array[String] = Array("-I", vepped_path, "-O", tmpFile.getAbsolutePath, "-m", "standard")
     main(arguments)
   }
 
diff --git a/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/rscript/Rscript.scala b/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/rscript/Rscript.scala
index 685108d0cb7f31cebfcc4b998017ae0a4c91726f..3dfac894eeb591a84a31b3fd5bcfa88c34619192 100644
--- a/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/rscript/Rscript.scala
+++ b/public/biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/rscript/Rscript.scala
@@ -28,7 +28,11 @@ trait Rscript extends Configurable {
     } else {
       val rScript: File = dir match {
         case Some(dir) => new File(dir, script.getName)
-        case _         => File.createTempFile(script.getName, ".R")
+        case _ => {
+          val file = File.createTempFile(script.getName, ".R")
+          file.deleteOnExit()
+          file
+        }
       }
       if (!rScript.getParentFile.exists) rScript.getParentFile.mkdirs
 
diff --git a/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/ConfigUtilsTest.scala b/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/ConfigUtilsTest.scala
index ad8ff00ee2e8a09026168efbf99f5926b4583c50..6bac74cdf9f3bf6148a78b05271593242d9b2d07 100644
--- a/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/ConfigUtilsTest.scala
+++ b/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/ConfigUtilsTest.scala
@@ -228,6 +228,7 @@ class ConfigUtilsTest extends TestNGSuite with Matchers {
 object ConfigUtilsTest {
   def writeTemp(text: String, extension: String): File = {
     val file = File.createTempFile("TestConfigUtils.", extension)
+    file.deleteOnExit()
     val w = new PrintWriter(file)
     w.write(text)
     w.close()
diff --git a/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordListTest.scala b/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordListTest.scala
index b748006c2800d5e86aad9e5f918a3d4bf5894c2c..0490b28db7dbf199a9b01c1b48c6783f11720f7d 100644
--- a/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordListTest.scala
+++ b/public/biopet-utils/src/test/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordListTest.scala
@@ -39,6 +39,7 @@ class BedRecordListTest extends TestNGSuite with Matchers {
     records.header shouldBe Nil
 
     val tempFile = File.createTempFile("region", ".bed")
+    tempFile.deleteOnExit()
     records.writeToFile(tempFile)
     BedRecordList.fromFile(tempFile) shouldBe records
     tempFile.delete()
@@ -50,6 +51,7 @@ class BedRecordListTest extends TestNGSuite with Matchers {
     records.header shouldBe BedRecordListTest.ucscHeader.split("\n").toList
 
     val tempFile = File.createTempFile("region", ".bed")
+    tempFile.deleteOnExit()
     records.writeToFile(tempFile)
     BedRecordList.fromFile(tempFile) shouldBe records
     tempFile.delete()
@@ -129,13 +131,6 @@ class BedRecordListTest extends TestNGSuite with Matchers {
     list.scatter(100).allRecords.size shouldBe 15
     list.scatter(100).length shouldBe 1500
   }
-
-  @AfterClass
-  def end: Unit = {
-    BedRecordListTest.bedFile.delete()
-    BedRecordListTest.corruptBedFile.delete()
-    BedRecordListTest.bedFileUcscHeader.delete()
-  }
 }
 
 object BedRecordListTest {
@@ -149,6 +144,9 @@ object BedRecordListTest {
                      |chr22	2000	6000	cloneB	900	-	2000	6000	0	2	433,399	0,3601""".stripMargin
 
   val bedFile = File.createTempFile("regions", ".bed")
+  bedFile.deleteOnExit()
   val corruptBedFile = File.createTempFile("regions", ".bed")
+  corruptBedFile.deleteOnExit()
   val bedFileUcscHeader = File.createTempFile("regions", ".bed")
+  bedFileUcscHeader.deleteOnExit()
 }
\ No newline at end of file