The episode was even titled "Murder He Wrote". He mentions that it feels like he is Jessica Fletcher in an episode of Murder, She Wrote. An episode invokes this when Castle goes to expend a soothing weekend in the Hamptons (a lot more exclusively, with Beckett, who is now his girlfriend) but a murder victim stumbles into his backyard and dies in his pool, wrecking the Two-Person Pool Party that was about to go down.