Fix texture and shader resource leaks.