Rebase and restructure closing function
Adds possibility for unit testing with logging
Adds possibility for unit testing with frontend
Adds testing for the frontend server