Core/RA: Addition to previous crashfix

To make sure it also works for sessions that use more than 1 command
before closing.