Switching to close and open for node using JavaScript