Hi Denny,
The voltage at D4 cathode is way too high. Abs max is 37V and in your scopeshots it is nearly 60V.
The input voltage for the optocoupler needs to be clamped by a zener diode in case of high output voltages.
As an example please have a look at…