Cache the current title and restore it when the function exists

This addresses issue #60