Make sure the connection is terminated before.