Unexpected crushing of task. What is the reason?

I am using a task created on PsyPy3_PY2. Usually, it runs without problems. However, recently, sometimes it stops suddenly towards the end and I get the following error message. What could be the reason for that?

File "C:\Users\user1\Desktop\REST_study\REST_task_eyetracking\REST_Learning_Transfer_3.0_eyetracker_PY2.py", line 4506, in <module>

    image1_tranfb_2.setImage(imageA)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\visual\image.py", line 301, in setImage

    setAttribute(self, 'image', value, log)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\tools\attributetools.py", line 141, in setAttribute

    setattr(self, attrib, value)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\tools\attributetools.py", line 32, in __set__

    newValue = self.func(obj, value)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\visual\image.py", line 288, in image

    forcePOW2=False)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\visual\basevisual.py", line 875, in _createTexture

    intensity = numpy.array(im)

MemoryError

46.6319     WARNING     Monitor specification not found. Creating a temporary one...

Error in atexit._run_exitfuncs:

Traceback (most recent call last):

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\data\experiment.py", line 390, in close

    self.saveAsPickle(self.dataFileName)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\data\experiment.py", line 375, in saveAsPickle

    pickle.dump(self, f)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 1376, in dump

    Pickler(file, protocol).dump(obj)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 224, in dump

    self.save(obj)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 331, in save

    self.save_reduce(obj=obj, *rv)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 425, in save_reduce

    save(state)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 286, in save

    f(self, obj) # Call unbound method with explicit self

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 655, in save_dict

    self._batch_setitems(obj.iteritems())

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 669, in _batch_setitems

    save(v)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 286, in save

    f(self, obj) # Call unbound method with explicit self

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 606, in save_list

    self._batch_appends(iter(obj))

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 621, in _batch_appends

    save(x)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 331, in save

    self.save_reduce(obj=obj, *rv)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 425, in save_reduce

    save(state)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 286, in save

    f(self, obj) # Call unbound method with explicit self

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 655, in save_dict

    self._batch_setitems(obj.iteritems())

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 669, in _batch_setitems

    save(v)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 331, in save

    self.save_reduce(obj=obj, *rv)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 411, in save_reduce

    self.memoize(obj)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\pickle.py", line 247, in memoize

    self.memo[id(obj)] = memo_len, obj

MemoryError

46.6319     WARNING     Monitor specification not found. Creating a temporary one...

Error in atexit._run_exitfuncs:

Traceback (most recent call last):

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\logging.py", line 300, in flush

    logger.flush()

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\logging.py", line 285, in flush

    formatted[thisEntry] = self.format % thisEntry.__dict__

MemoryError

Error in sys.exitfunc:

Traceback (most recent call last):

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\atexit.py", line 24, in _run_exitfuncs

    func(*targs, **kargs)

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\logging.py", line 300, in flush

    logger.flush()

  File "C:\Program Files (x86)\PsychoPy3_PY2\lib\site-packages\psychopy\logging.py", line 285, in flush

    formatted[thisEntry] = self.format % thisEntry.__dict__

MemoryError