frontend: add hook so that the application can exit
Currently, bitmask.js has the ability to send a message to the backend to kill off the backend.
We also need some hook to be able to kill off the frontend.
My preference is this:
- The bitmask ui tells the backend to shut down.
- After it has successfully shut down, then it tells the frontend to shut down.