Close connection after measurment