Minor fix to clear session before releasing the session

This caused some issues when running on the grid as the previous session was being cleared when a new session was being created.

By allowing the previous session to be cleared and then "releasing" the session this problem no longer occurs.

Sergio