I wrote a little code for multitrading in which I convert images to gray. The code works fine, but I get an error, "Memory access error (memory dump written)