The Prisoner
(2007)

On location for his new movie, brillant but egotistical filmmaker Derek Plato (Julian McMahon) is held captured by a man only know as Jailor (Elias Koteas). Over a series of discussion the Jailor makes Derek confront his past involving his mother.

It turns out that his mother Renee (Kim Raver) did not commit suicide. Young Derek was filming his mother bathing and when she shooed him out, he accidentally knocked a radio in the tub causing her electrocution. Derek has been repressing the memory for so long that coming to the prison unleashed it. The Jailor seemingly executes Derek only for him to wake up in a cell. The whole thing was a dream; the Jailor (whose image turns out to be on a headshot Derek saw) and his captivity was only in his mind.

Derek leaves the prison as his agent/girlfriend Olivia shows up. It is inferred that since Derek has confronted this memory, he will move on with his life, fix his relationship with Olivia, and be a better person overall.

Thanks Spectre!