SDCardUtil: Moved write_sector into a lambda, fail_write back out