Cobra looses all objects after steps specified inside

Handle System.UnauthorizedAccessException

Issue reported by Baza

import ldtp

def open_new_tab():
    ldtp.activatewindow(FF_TITLE)

    ldtp.generatekeyevent('<ctrl>t')

    ldtp.wait(5)

def close():
    ldtp.activatewindow(FF_TITLE)

    ldtp.generatekeyevent('<alt><f4>')
    ldtp.waittillguinotexist(FF_TITLE, guiTimeOut=20)

FF_TITLE = '*Mozilla Firefox*'

ldtp.launchapp(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
ldtp.wait(5)
open_new_tab()
ldtp.wait(5)

print ldtp.getwindowlist()
print ldtp.guiexist(FF_TITLE)

close()

print "-----------"
print ldtp.getwindowlist()
print ldtp.guiexist(FF_TITLE)

QA Notes:
Testing Done: Verified with the above test
Documentation Notes:
Bug Number:
Reviewed by:
Approved by:
Mailto: