Fixed close connection bug