Online One-Dimensional Magnetic Field SLAM with Loop-Closure Detection