(None of this is tested, as I've never tried to run away from them).
Firstly, I'm pretty sure that any boss despawns if you log out, as Katustrawfic said. Though it's a nighttime event heralded by a system message, it's different from, say, a Blood Moon, so they should be gone if you just quit and reload.
Apart from that, going from the Wiki page (and poking around), it looks like the easiest way to despawn the Twins is to get far away from them-- they're set to despawn if the distance between you gets too large. A magic mirror used far away from your spawn point would likely accomplish this.
Or you could use a teleporter.
For rigor's sake, I'll also add that apparently any flying enemy, apart from Wyverns, can be despawned by making them fly out of bounds (off the map). This seems to happen often if The Twins are summoned while you're sitting at the top of the map, since their spawn position is relative to yours. So you could try hanging out at the top of the map if you're anticipating them-- but this doesn't seem like a particularly efficient strategy to me.
But I'd say try logging out first; that should work, and will easily be the most surefire/painless strategy.