This is a puzzler for many new ... and even not so new! ... folks in editing.
The CTI ... the current time indicator or "playhead" ... is never in-between frames, it is always attached to a frame.
So if the CTI is past the last frame of the last clip, it is actually showing what's 'there', which is a blank ... therefore black ... image.
To have the last one be of your image, you need to have the CTI on the last frame ... not after it.
And to export without a black frame, the CTI needs to be on the last frame also. Not after it.
By the way, there is a keyboard shortcut to go to the last frame. Different from the command to go to the end. It's really necessary to learn when to use last frame, and when to use go to end.