AttributeError: 'NoneType' object has no attribute 'close'

The error is happening here:

File “/usr/local/lib/python3.6/dist-packages/psychopy/visual/backends/gamma.py”, line 152, in getGammaRamp
raise AssertionError(‘XF86VidModeGetGammaRamp failed’)
AssertionError: XF86VidModeGetGammaRamp failed

Could you post your video card information?

You might find some potential solutions in this thread or this github issue.