Added command line option support and stopping background network thread
on gui close.