Indeed, a closed loop or continuous pathway is required for current to flow in a wire. Our term for this continuous pathway for current flow is a circuit . The source does work on the electrons to move them, increasing the electron's kinetic energy. Or, before the switch is opened, the voltage source can do work on the electrons, increasing their potential energy. When the electrons travel they can do work on other things, giving up its energy gained from the source.
All materials resist the passage of electrons, some better than others.
Other materials, e.g. most plastics, ceramics and rubber products are highly resistant to electrons passing through them. These materials are used to clad wires, preventing the electrons from leaking out of the wire or jumping to another wire. The top tray with marbles is tilted slightly. Marbles on the top have more gravitational potential energy than do those at the bottom. Hence, they roll down the slanted surface.