Fixed close connection issue