Main Thread
Close reąuest receivedby main thread
Mainthread sets terminated property of calculation thread.
M ain thre ad waits for calculation thread to teiminate
Pritne calculation thread.
Thread reads terminated property as false, anduses synchronize to transfer result. Synchronize waits for main thread to become idle.