stops the main thread