should deallocate window after thread is terminated