WIP: State machine / progress page

This is essentially a rewrite to a state machine.

Goals:
* [x] Answer HTTP requests while opening the window
* [x] hitting "close" while it's opening the window aborts the open and starts closing
* [ ] add a JSON status page with
   * [ ] open/close status
   * [ ] remaining time, when opening
* [ ] add JS so that hitting one of the buttons creates a progress bar with the info from above status page