Initiation and Adaptive Termination of Goal-directed Behavior in Mice