Added open/close methods to directory.js