I’m not sure why can’t I make document.close or document.closeWithoutSaving; to work. I think it is a simple enough command. I’m using photoshop 24.1 and working on a plugin. try-catch block did not detect any errors.
It looks like you aren’t calling it with () after the method name
Try app.documents[1].closeWithoutSaving(); in the close function. Tested on my machine and it closes with no issues. If you still face errors, it may have to do with some other logic you’re using.