Numerical simulation of slow spheromak formation: Flux control by formation speed