Avoid leaking the bitmapData in case of error