When the first switch is thrown the electrons flow until the voltage (height) of the capacitor matches the cell.
Note that the current (red) starts out large and decreases as the capacitor becomes fully charged.
When the voltage (height) across the capacitor matches the cell no current will flow.
The capacitor is now charged and is storing electrical potential energy.