Write file to disk, using promises and creating recursively intermediate directories if they don't exist.