Octoprint stuck on the last layer

octopi always stuck on the last layer without executing the end gcode.
printed from sd card. starting the print from the octopi or the lcd is giving me the same result.

What is the problem?
octopi always stuck on the last layer without executing the end gcode.

What did you already try to solve it?
tried removing G4 from the end g code in cura

Logs (octoprint.log, serial.log or output on terminal tab at a minimum, browser error console if UI issue ... no logs, no support!)

https://pastebin.com/zGWbuqKJ

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible)
octopi version 0.17 on raspberry pi 4. ender 3 pro on marlin 2.0.2 skr mini e3 1.2

Hello @floxflux

I found these two:

2020-01-30 14:01:24,748 - octoprint.plugins.pi_support - WARNING - This Raspberry Pi is reporting problems that might lead to bad performance or errors caused by overheating or insufficient power.
!!! FREQUENCY CAPPING DUE TO OVERHEATING REPORTED !!! Improve cooling on the Pi's CPU and GPU.

--> You should do something against overheating the Pi.

2020-01-30 19:29:12,920 - octoprint.util.comm - INFO - Changing monitoring state from "Printing from SD" to "Cancelling"
2020-01-30 19:29:12,923 - octoprint.util.comm - INFO - Force-sending M108 to the printer
2020-01-30 19:29:12,925 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: sdcard, path: bed_br~1.gco, owner: None, user: geometrieva
2020-01-30 19:29:12,945 - octoprint.util.comm - INFO - Pausing print job due to command M25
2020-01-30 19:34:39,593 - octoprint.util.comm - ERROR - Unexpected error while reading from serial port
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 2793, in _readline
    ret = self._serial.readline()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 4932, in readline
    c = self.read(1)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/serialposix.py", line 501, in read
    'device reports readiness to read but returned no data '
SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
2020-01-30 19:34:39,609 - octoprint.util.comm - ERROR - Please see https://faq.octoprint.org/serialerror for possible reasons of this.
2020-01-30 19:34:39,613 - octoprint.util.comm - INFO - Changing monitoring state from "Cancelling" to "Offline (Error: SerialException: 'device reports readiness to read but returned no data (device disconnected or multiple access on port?)' @ comm.py:_readline:2793)"

It seems the SD card file canceled the print job:

2020-01-30 19:29:12,925 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: sdcard, path: bed_br~1.gco, owner: None, user: geometrieva

How does the end gcode look?

my fan was stuck into the heatsink before. but i fixed it prior to printing the last one. i printed it 3 times, all with the same result.

G1 F1680 X153.282 Y130.089 E1823.42483
M204 S1100
M205 X18 Y18
G0 F9000 X153.668 Y129.909
M204 S500
M205 X11 Y11
G1 F1680 X153.848 Y130.089 E1823.43245
;TIME_ELAPSED:2328.245240
G1 F4200 E1819.43245
M140 S0
M205 X10 Y10
; Ender 3 Custom End G-code
G4

M220 S100 ; Reset Speed factor override percentage to default (100%)

M221 S100 ; Reset Extrude factor override percentage to default (100%)

G91 ; Set coordinates to relative

G1 F1800 E-6 ; Retract filament 3 mm to prevent oozing

G1 F3000 Z20 ; Move Z Axis up 20 mm to allow filament ooze freely

G90 ; Set coordinates to absolute

G1 X0 Y220 F1000 ; Move Heat Bed to the front for easy print removal

M84 ; Disable stepper motors

; End of custom end GCode
M82 ;absolute extrusion mode
M104 S0

i did try it with and without the G4 command.

i tried to cancel it while it stuck on the last layer so i can move the z axis manually. because the end gcode wasnt running at all.