Electrodynamic theory of finite magnetostatic waveguides