Save the state of collapsed/expanded text upon close/open?

TaskPaper should already be doing this for restored documents:

If you leave your document open and then quit TaskPaper then when you reopen TaskPaper that same document should open, and it should restore folding state. If you close a document (or don’t disable “Close windows when quitting an app (see above link)”) then folding state won’t be restored.