This brings two benefits: we will label the created file only if it is actually created, and we can correctly delete any file we create again on failure.