My problem is almost identical to this thread: Missing Top Layers
HOWEVER, in this case, it is most definitely OctoPrint 1.4.0 running on OctoPi 0.16.0.
I can confirm this because after numerous failed prints where the last 5-20 layers simply don't print, I've taken the same exact .gcode file and it printed fine from an sd card.
I should note that I also run the DisplayLayerProgress Plugin (1.22.1) - perhaps that is causing an issue? Any other ideas?