Fixed cleanup error for graphic device.