Fix bug where application keeps running in background after close due to
server search method