Just a wild guess, as you didn't show much of the code (nor the line that throws):
maybe your code applied some changes to the workbook, and Excel wants to know whether it should save or not.
If you want to close without saving, just set
oBook.Saved = true
before closing.
:)