only delete if there were no io errors
and return an error