Closed-Loop and Activity-Guided Optogenetic Control