refactoring: make periodic handler use weak references

PeriodicHandler now uses weak references to keep a link to the looper
that requested it. This way, it will not prevent the source from being
garbage collected even though a delayed message may be queued in the
handler.

Also, at the next iteration, the periodic handler will notice that its
starter looper has been garbage collected and will stop itself if it has
not been already.