Added disconnect to on end resource method.