Learning in a closed-loop brain-machine interface with distributed optogenetic cortical feedback