Fixed the bug about file opening, saving, and closing.