The program should shut down gracefully when the window is closed. This includes:
- shutting down the web server
- finishing any database transactions
- finishing any recordings
- closing the serial port
- any other graceful shutdown that needs to be done for electron specifically
The program should shut down gracefully when the window is closed. This includes: