Make double-sure that the folder really exists before writing to it.