close factories during plugin shutdown