A concatenated stream trick

If you pass a stream to a library function that closes it (as with with-open-stream), but you want the stream to remain open, you can wrap the stream in a concatenated stream:

(auto-closing-function (make-concatenated-stream my-stream))

When the concatenated stream is closed, the wrapped stream my-stream remains open.

(Thanks to Rob Warnock for this tip.)