Improve foreman task pooling

Checking for state is the better approach to verify if the task is
running or not. Also reduced the timeout because this improvement.

This fix the timeout issues because the polling still happening even though the task have finished.

The check for state suggestion came from the devs, thanks jsherrill for the information.

```
you might look at 'state' instead for 'stopped' or 'paused'
from the foreman-tasks code:
   scope :running, -> {  where("state NOT IN ('stopped', 'paused')") }
so its defining 'running' as a task not in either of those two states
```