Fix location of free when closing connection.