correctly end connection during runCommit command