In my work, I am opening a notebook file, evaluating and writing commands to it through Mathematica Kernel. I want to save my results into a new file (notebook or pdf format). When I use NotebookSave[] option, the save dialog box appears and I am able to save it. But when I open it later, there seems to be an error and a message pops in that the file is corrupt.
What should I do now?