Fix clean up of context.

Signed-off-by: Daniele Basile <asterix@develer.com>
Trap error to prevent wizard craches.

Signed-off-by: Daniele Basile <asterix@develer.com>