Use \unexpanded instead of the protected immediate write.

This fixes some long standing issues where TeX commands
may be expanded before they are written to the sdaps file.
See also issue #6 (and #37).