Large-scale, closed-loop interrogation of neural circuits underlying cognition