Fix multithreading crashes

Fix crashes caused by accessing GraphicsPath and Bitmap objects from multiple threads.