Secret Window

Stephen King (novel), David Koepp (screenplay) 2004

IMDB: https://www.imdb.com/title/tt0363988/

A successful writer in the midst of a painful divorce is stalked at his remote lake house by a would-be scribe who accuses him of plagiarism.