Update index.js

end all the redis connection when that is not in use