calling the dispose method of object bitmapData before creating it again to avoid memory issues