added automatic process k-v pairs + close call