[JENKINS-17931] Cleanup temp files in case of an error

If errors arise, the temp files should be deleted