I have the same question. I'm generating a sequence diagram out of instrumentation added to old code in an attempt to understand how it works so I can fix it. I'm using lifelines to show the life span of open-resources, and the resources are not being closed in opposite order that they were opened. I'm color coding the resources. In the example, resource 3 is orange, but the orange lifeline ends when resource 2 is closed because it was the last one opened.
@startUML
participant a
participant b
activate a #red
hnote across: open 1
a->b
activate a #blue
hnote across: open 2
a->b
activate a #orange
hnote across: open 3
a->b
hnote across: close 2
a->b
deactivate a
hnote across: close 3
a->b
deactivate a
hnote across: close 1
a->b
deactivate a
@endUML