Here is an excerpt from Dummit and Foote Abstract Algebra 3rd edition page 137, chapter 4.4:
Suppose $G$ is a group of order $45 = 3^25$ with a normal subgroup $P$ of order $3^2$. We show $G$ is necessarily abelian. The quotient $G/C_G(P)$ is isomorphic to a subgroup of $Aut(P)$ by Corollary 15, and $Aut(P)$ has order $6$ or $48$... On the other hand, since the order of $P$ is the square of a prime, $P$ is an abelian group, hence $P \leq C_G(P)$. It follows that $|C_G(P)|$ is divisible by $9$ which implies $|G/C_G(P)|$ is $1$ or $5$. Together these imply $|G/C_G(P)| = 1$, i.e. $C_G(P) = G$ and $P \leq Z(G)$. [[[[[Since then $G/Z(G)$ is cyclic,]]]]] $G$ must be an abelian group.
I understand everything but the bracketed part. If you could explain why the bracketed part is true that'd be great.