Interaction of an Erupting Filament with the Ambient Magnetoplasma and Escape of Electron Beams