Fix a memory leak problem on close connection.