Control of domain wall pinning in ferromagnetic nanowires by magnetic stray fields