My best guess is that this is due to the length of a group of pictures. h.264 streams are composed of 3 different types of frames. I frames, which contain the full frame, P frames which contain the information that has changed since the previous frame and B frames which are bi-directional and contain information about the changes between previous and future frames.
These frames are used in a fixed order that is repeated. That repeated set is known as a group of pictures. Typical GOP lengths are generally somewhere around 15 frames. At 15 or more FPS, you'll always finish your GOP within one second. At half a frame per second though, it can take up to 7 seconds after your last normal frame for the GOP to finish.
That still doesn't seem to fully explain your 12 extra seconds, but it is possible you are using a longer GOP. I can't think of any other potential causes.
It is also worth noting that under the hood, Handbrake is just a UI for other encoding libraries, one of which is FFMPEG, so that may also help explain the consistent behavior as well.