If a slave is in terminal state do not consider it active

This fix is for on demand registration feature. Sometimes the Mesos spawned Jenkins slave goes into TASK_LOST state after the build is complete. On this event, supervise() method will  get called but the node will still be in Jenkins. So in this case supervise() would not disconnect Jenkins from Mesos cloud at all. This change makes sure the slave is marked as active only if it is not in terminal state.