I have very little leads to go on, since I only vaguely remember the ending. It's most likely a foreign film, I wanna say France or Italy. The mood of it reminded me a lot of The Long Goodbye. It happens (most likely) in a small town. There's a detective, young, late 20s, early 30s. There's a beutiful woman and there's something strange about their relationship. Now here's what I remember for sure: before the end there's a scene where the detective's driving up a hill to the woman's place. They meet and the detective confronts her about something. Later there's a shot of the man standing on a balcony and pressing a gun against his head. The woman comes silently from behind, takes his hand and presses the gun down. They talk quietly, maybe kiss.
The film was very atmospheric, almost dreamy. There was slowly rising suspense and a lot of quiet shots. I could be wrong about it being from the 90s.