You have kept exclusive: true
.So it will give you an error if file already exist try setting it to false.Check this out
So change your code from this
dataDir.getFile("data_1539.txt", { create: true, exclusive: true }, onFileCreated, null);
to
dataDir.getFile("data_1539.txt", { create: true, exclusive: false}, onFileCreated, fail);
function fail(error) {
console.log(error.code);
}