Just to cite the music world for a moment, here are some examples of artists who recorded perhaps their finest work and/or greatest hit just before they died.
Louis Armstrong died three weeks after recording the song he is best remembered for, ironically titled; 'We Have All The Time In The World' which was also a Bond hit in the 1969 Bond film 'On Her Majesty's Secret Service'. Like most Bond films the music was written by John Barry. Lyrics were by Hal David.
Although he didn't write it himself, Johnny Cash recorded what came to be known as the definitive version of 'Hurt' in the last few weeks before he died. His wife, fellow country star June Carter Cash, had predeceased him several months earlier and all the pain of his loss, his own illness and all the hurt he was sorry for in his life seems to be condensed into this one haunting record with an equally haunting video reviewing scenes of his life.
Otis Redding was only 26 when he died in a plane crash in 1967, and did not even live to see his greatest hit 'The Dock of The Bay' released. Ironically, as with 'We Have All The Time In the World', this song also features a character who considers he has all the time in the world as he sits on the dock of bay 'wastin' time'..
These are just three, I am sure you can think of many more examples in every field of life of people who achieved their finest work later in life or just before they died. It is never too late to leave a legacy behind, even if you feel you missed the boat when young.