How to close Realm when I export it and use it with Promise?

Hello everyone, I have 2 questions.

#1:
I found this code on the internet and tried to study it, all this code will be in a .js file, and when I call all the functions in the main .js, the app works fine, but I was reading in the docs that I need to close Ream after use it, and I was trying to do it, but I can’t use realm.close() anywhere, can someone explain how to implement closure please? Sorry for my English, I really tried to explain this.

import Realm from “realm”;
export const TODOLIST_SCHEMA = “TodoList”;
export const TODO_SCHEMA = “Todo”;

export const TodoListSchema = {
name: TODO_SCHEMA,
primaryKey: “_id”,
properties: {
_id: “int”,
title: { type: “string”, indexed: true },
description: “string”,
done: { type: “bool”, default: false },
}
};

export const TodoSchema = {
name: TODOLIST_SCHEMA,
primaryKey: “_id”,
properties: {
_id: “int”,
title: “string”,
description: “string”,
creationDate: “date”,
todos: { type: “list”, objectType: TODO_SCHEMA },
},
};

const databaseOptions = {
path: “todoList.realm”,
schema: [TodoListSchema, TodoSchema],
schemaVersion: 0,

export const insertNewTodoList = newTodoList => new Promise((resolve, reject) => {
Realm.open(databaseOptions).then(realm => {
realm.write(() => {
realm.create(TODOLIST_SCHEMA, newTodoList);
resolve(newTodoList);
});
}).catch((error) => reject(error));
});

export const updateTodoList = todoList => new Promise((resolve, reject) => {
Realm.open(databaseOptions).then(realm => {
realm.write(() => {
let updatingTodoList = realm.objectForPrimaryKey(TODOLIST_SCHEMA, todoList._id);
updatingTodoList.title = todoList.title;
updatingTodoList.description = todoList.description;
resolve();

    });
}).catch((error) => reject(error));

});

export const deleteTodoList = todoListId => new Promise((resolve, reject) => {
Realm.open(databaseOptions).then(realm => {
realm.write(() => {
let deletingTodoList = realm.objectForPrimaryKey(TODOLIST_SCHEMA, todoListId);
realm.delete(deletingTodoList);
resolve();
});
}).catch((error) => reject(error));
});

export const deleteAllTodoList = () => new Promise((resolve, reject) => {
Realm.open(databaseOptions).then(realm => {
realm.write(() => {
let allTodoList = realm.objects(TODOLIST_SCHEMA);
realm.delete(allTodoList);
resolve();
});
}).catch((error) => reject(error));
});

export const queryAllTodoList = () => new Promise((resolve, reject) => {
Realm.open(databaseOptions).then(realm => {
realm.write(() => {
let allTodoList = realm.objects(TODOLIST_SCHEMA);
resolve(allTodoList);
});
}).catch((error) => reject(error));

});

export default new Realm(databaseOptions);

2#
From the previous code I modified the options to make it simpler and it works fine in a simple CRUD of notes, but I wanted to know if it is poorly structured and it should be 2 schematics as above.

export const NOTELIST_SCHEMA = “NotaList”;

export const NoteListSchema = {
name: NOTELIST_SCHEMA,
primaryKey: “_id”,
properties: {
_id: “int”,
title: “string”,
description: “string”,
creationDate: “date”,
}
};

const databaseOptions = {
path: “NotaList.realm”,
schema: [NoteListSchema],
schemaVersion: 0,

Sorry for posting 2 questions, I’m just on a personal project and I’m learning by myself how to use Realm