Node sqlite3 when to close db
<p>I cannot figure out when to close a db in node-sqlite3, or really how to use the package in general. It seems if I run this, I get "no such table:rooms". Eventually after running it enough times, I might manage to make the table.</p>

<pre><code>var sqlite3 = require('sqlite3').verbose();

class RoomManager{
    constructor(options){

        this.db = this._createDb();
        this.table = "rooms";

        this._createTable();
        this.addRoom({
            name : 'test3'
        }).getRooms()
        this.deleteRoom({
            name : 'test3'
        }).getRooms();

        return this;
    }

    _createDb() {
        return new sqlite3.Database('chat');
    }

    _createTable(){
        this.db.run("CREATE TABLE IF NOT EXISTS " + this.table + " (name TEXT, size INT)");
        return this;
    }

    addRoom(options){
         this.db.run("INSERT INTO " + this.table + " (name, size) VALUES ($name, $size)", {
            $name : options.name,
            $size : options.size || 1000
        });
        return this;
    }

    getRooms(){
        this.db.all("SELECT rowid, name, size FROM " + this.table, function(err, rows) {
            rows.forEach(function (row) {
                console.log(row.rowid + ": " + row.name + " - " + row.size);
            });
        });
        return this;
    }

    getRoom(options){
        if(options.name){
            this.db.get("SELECT * FROM " + this.table + " WHERE name = $name", {
                $name : options.name
            }, function(err, row){
                return row;
            });
        }
    }

    deleteRoom(options){
        this.db.run("DELETE FROM " + this.table + " WHERE name = $name", {
            $name : options.name
        });
        return this;
    }
}

module.exports = RoomManager;
</code></pre>