thin3d: Fix some leaks in d3d9 code.