How to save a file

What’s the return value from result? It’s possible batchPlay is returning you an error in result (batchPlay generally doesn’t throw).