small fix
Fixed application running after the gui closed, also some gc