clean up pixel unpack buffer for dynamic textures, and add some more error handling code for other GL functions