MAINT make export_graphviz more exception-safe