You'll have to see the ending twice to work out the details.
There are some very clever manipulations done here.
And at the end, you need to try to go back and construct a time line and a motive line to see that they have covered all the things that appear to be plot holes. Because everyone has an ulterior motive, a secret, and a scene where they are surprised by events. But you change your mind later about why they were surprised, and whether that makes them more or less of a suspect.