Code doesn't run instantly. Your drawing code in particular uses a lot more function calls than it needs to, because with each frame you're drawing to many individual points multiple times. The delay this generates, when compounded by the fact that peripheral calls are particularly slow, leads to a noticeable flicker effect while the display is in the process of being redrawn.
If we do our peripheral calls just before clearing the screen (saving the results to variables), and take care not to redraw more than we have to, we can speed things up somewhat. Eg something along the lines of this (untested) code:
That should just about eliminate any flicker.
In regards to your game crashes, difficult to comment on those without seeing the resulting logs, but off the top of my head I'm going to guess you're running OptiFine or similar.