fixing close connection callback issue