check if localsession object null before closing

No match.