First, Gwen was never "supposed" to die. It was enough to have her die several times in the comics, but to kill off a movie-version of Gwen that was so incredibly well-developed and beloved was a mistake. It's like they just had to throw it in there and see what happens. Second, having the movie end with her death or Peter by her grave would indeed be a horrible and sad ending that wouldn't fit "The Amazing Spider-Man". The movie was already a bit too dark (which the developers tried to avoid) but then they make it way too dark by having a great character killed off for no apparent or necessary reason. The movie ended by having Peter listening to Gwen's speech, and this gave him courage to continue as Spider-Man and honor her life. But this was completely unnecessary and meaningless. They could as well have kept Gwen alive at Peter's side for future adventures together. But yes, Sony indeed did fail big time with this film.