Add VTK version 6 compatibility
Use mkstemp instead of tmpnam