Fixes #23 - Only clear local storage after it successfully saved.