tests: makeFileUpload: Use unittest addCleanup() to close files rather than tearDown().

This executes even if setup() encounters an error and the cleanup hook is added
when opening the file, not later on.

Also, unify makeFileUpload() and makeFilePath() to remove duplicated code.

Co-authored-by: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
3 jobs for for_testrunner_1
Status Job ID Name Coverage
  External
passed ERP5.CodingStyleTest-TestRunner1

01:32:46

failed ERP5.PerformanceTest-TestRunner1

00:35:12

running ERP5.UnitTest-TestRunner1

4493:17:09