The flash sideways throughout Season 6, which ultimately led to the final scene in the Chapel, were a 'limbo' between death and whatever happens next, designed to teach each character to put right things which they had done wrong when they were alive i,e Sayid letting his brother have Nadia, Sawyer being a cop and Ben being a teacher.Because of their experiences together all the Losties had to be together to 'move on' to whatever came after death.