Added open/close methods. Only needed for sql