Terminate session before execute restore query