Fix cleanup of camera thread when stopping in GUI mode