code: protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) {
  		if (mConnectionState != STATE_DISCONNECTED) {
  			// Disconnect from the device
  			disconnect(gatt);
  		}
  
  		// Close the device
  		refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower
  		close(gatt);
  		waitFor(600);
  		if (error != 0)
  			report(error);
  	}
docs: Disconnects from the device and cleans local variables in case of error.
  This method is SYNCHRONOUS and wait until the disconnecting process will be completed.
  
  @param gatt  the GATT device to be disconnected.
  @param error error number.