Add a cleanup function to end icarus

Closes the socket