Refactor server UI code
Add close button to main window