If you add a piece of background music to your iMovie project, the length of the music may be longer than your video. You can set the music to fade out at the appropriate time by dragging the Fade Out dot to the left. You can use this technique whether you use iMovie's special background music track or attach the music to a clip in the main part of the timeline. You can also fade in and add other changes in volume at any point.
Want to know more about how to use iMovie on your Mac? Check out this MacMost course!