“The damned” ending?

Can someone explain to me the plot twist at the end. Was it really all just in their heard