Fix bugs of file output API in FileUtils API that will pre-create a corresponding parent directory