by Ken Task.
Hard to say ... so more questions ...
When the automated backup script fails, Is there a directory in /moodledata/temp/backup/ with a long name ... something like '02a5c174a5e99ff94ee40113ae54a9929c638e4d'. If so, there should also be a matching .log file that might give a hint at what stage the course backup failed.
If it reached 900 (finished is 1000) could be there is a valid good backup with an .mbz file extension in (as per example) 02a5c174a5e99ff94ee40113ae54a9929c638e4d. The very last step in the backup process is to *copy* the backup to a destination .... if set to defaults, that is back into the sea of files in moodledata/filedir/ Depending upon operating system and permssions/ownerships of moodledata that could be the hickup ... can't copy the file ... notice that's copy ... not move.
Then there is always a chance that another automated task to clean up is actually romping on the automated backup ... ie, clean up happens while Moodle trying to complete an automated backup.
'spirit of sharing', Ken