Thanks for the help wd, but I'm afraid I do not have the skills to find what you are looking for. I am an electronics technician, not a programmer so the only experience I have with debugging is with very small programs(30 lines and less) I wrote for the 8086 CPU(and x51 MCU, but that's not relevant). I don't know if it's because the 80286(and up) are different but there are a lot of instructions I don't understand, and everything looks so different from what I'm used to (in the 8086 the 4 registers AX,BX,CX and DX are all 16bit, and here I see they are 32bit... and more).
anyway, I attached two pictures, one is the last int 15 call before the error appears, and the other is the last function 35 from the 21h software interrupt before the error appears.
I don't know if the few instruction visible in the pictures will help you see what's wrong, but here it is anyway(or maybe you could tell me what exactly to look for?).