Update index.js

Close connection for keepOpen=false