Create not yet existing directories when writing to a new file.