A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Closing document windows does not Quit the program. It allows it to continue running & can cause any Minimized or Hidden files to remain open as well. That makes everything subject to the type of misbehavior you described, including possible corruption or loss of data.
When a program is not being actively used either select the Quit command in the program name menu [e.g., Excel> Quit Excel] or use the Command+Q keyboard shortcut. If any files are open they will be closed also & there will be a prompt to save changes.