![](http://pics.livejournal.com/shasta_pasta/pic/0000s55a/s320x240)
I think after the worl pretty much ends at the end of Pandorica Opens, the Doctor find a way out and somehow finds the Vortex Manipulator that River had and begins traveling through time to stop this whole thing from happening.
Also, I just found out that the actress who plays Amelia is Karen's cousin. No wonder they looked so alike!