Update index.js

Check for keepOpen