Proof
Let $\tau$ denote that collection of $S(a,b)$. We show $\tau$ is topology. $\varnothing \in \tau$ is automatic. Next, since $\mathbb{Z} = \bigcup \{ n \} $ and $\{ n \} = S(1,0)$, then it is in $\tau$. Now, take a collection of $\{ S(a,b) \}_{a,b \in \mathbb{Z}}$. we need prove $\bigcup_{a,b} S(a,b) \in \tau $. Isnt this automatic by definition?
Finally, if $S(a_1,b_1)$ and $S(a_2,b_2)$ are two arithmetic progressions, then
$$ S(a_1,b_1 ) \cap S(a_2, b_2) = \{ a_1 n + b_1 \} \cap \{ a_2 n + b_2 \}$$
By choosing $n$, I think it is possible to write this intersection as union of elements of the form $\{ a_3 k + b_3 \}$ but, I am unable to do this rigorously. But I know it is possible by choosing $n$ appropriately..
(b)
If $x \in \bigcup_p S(p,0) $ then $x $ lies in some $S(p,0)$, that is $x = pn $for some $p$. Since $p \neq 1,-1$, then $x \in \mathbb{Z} \setminus \{-1,1\}$. Im stuck on the other inclusion. I mean it seems intutitively obvious, Im having hard time writing it rigorously.
finally, assume we have only finite number of primes. Notice that $\mathbb{Z} \setminus S(p,0) = \bigcup_{q \neq p} S(q,0) $ which is open so $S(p,0)$ is closed.
The complement of $\mathbb{Z} \setminus \{-1,1\} $ is $\{-1,1\}$ which is not open since set if finite... I havent used the fact that there are finitely many primes... where did I make a mistake?

(a) If a set $\tau$ of subsets of a set $X$ is defined as consisting of any union of elements of a set $B\subset\mathcal P(X)$, then it is automatic that the union of a family of elements of $\tau$ belongs to $\tau$ too.
And if $U_1,U_2\in\tau$ (now I mean the $\tau$ of your specific problem) and if $x\in U_1\cap U_2$, then there are integers $a_1$ and $a_2$ such that $S(a_1,x)\subset U_1$ and that $S(a_2,x)\subset U_2$. But then $S(\operatorname{lcm}(a_1,a_2),x)\subset U_1\cap U_2$. So, $U_1\cap U_2$ can be written as an union of sets of the form $S(a,b)$ and therefore it belongs to $\tau$.
(b) If $k\in\Bbb Z\setminus\{1,-1\}$, then there is some number $p$ such that $p\mid k$ and therefore $k\in S(p,0)$. And, if $l\in\Bbb Z$ is such that $l\in S(p,0)$ for some prime number $p$; then $l\ne\pm1$; in other words, $l\in\Bbb Z\setminus\{1,-1\}$.
Now, note that $S(p,0)^\complement=S(p,1)\cup S(p,2)\cup\ldots\cup S(p,p-1)$ ans that therefore $S(p,0)$ is a closed. If there were only finitely many primes, then $\bigcup_pS(p,0)$ would be a closed set too, and therefore its complement would be an open set. But the complement is $\{1,-1\}$ which is not open, since the only finite element of $\tau$ is $\emptyset$.