Move tearDownBeforeUnloadHandler() to cancel()

Make sure it always gets torn down on deactivate, not
just on save. Otherwise we end up with multiple copies of it.

Change-Id: I7b95c316641fc48ce7087a0042ec6174fe03180b
Merge "Move tearDownBeforeUnloadHandler() to cancel()"