add context unload event listener