3 interpretations of this story
In the special features, the director says that the movie begins when we enter the mirror of "Mort's mind" and concludes when the camera exits through the same mirror, each of which serving as bookends to what's happening in Mort's mind and reality existing on either end. So...
1. Mort, during one of his naps, dreamed the entire film and woke up to kill Amy as she arrived.
2. Mort, isolated in his cabin after the split, wrote the story we were watching as "Secret Window" which later appears in his short story collection, but it never really happened.
3. Mort, his pysche cracked by the split, imagined that Shooter was real, killed his own dog, killed the two men and finally killed his wife and lover.