[PATCH] ruby: make sure the database is closed