Fixed an async closure issue with textures.
Some code cleanup elsewhere.