Aidey,
In case it starts crashing again, there is one thing to consider--your RAM load-out:
16 GB RAM Upgradeable - [Instructions]
BANK 0/DIMM0
4 GB DDR3 1333 MHz ok
BANK 1/DIMM0
4 GB DDR3 1333 MHz ok
BANK 0/DIMM1
4 GB DDR3 1333 MHz ok
BANK 1/DIMM1
4 GB DDR3 1333 MHz ok
In iMacs of that generation there were persistent reports of odd crashes when four, 4GB RAM modules were installed in models like yours that can handle more RAM (the i5 and i7 models). Anything more or less than 16GB gave normal performance. Whether this is a true hardware bug or a problem with non-conformng RAM was never established. However changing the TOTAL RAM installed to anything than 16GB seemd to fix the issue.
If it starts again, pull ONE RAM module and test. Your iMac will run on three modules for test purposes.