Update index.js

end all the redis connection when that is not in use
Merge pull request #9 from nickhsine/master

Update index.js