NSFNoteClose crashes notes server

I open up the note and extract the attachment file name. Once I am done I close the note using NSFNoteClose() with the same note handle. This in turn causes a NSD process to be ran.

I was wondering if anyone have ran into this issue or have any idea why this might be happening.