Let $X^n$ be a complex manifold and $\sigma:\hat{X} \to X$ the blow-up at a point $x \in X$ and $E = \sigma^{-1}(x)$ the exceptional divisor.

It is known that the canonical bundle of $\hat{X}$ is given by $K_{\hat{X}} = \sigma^*K_X\otimes \mathcal{O}((n-1)E)$. I am trying to understand why $H^0(\hat{X},K_{\hat{X}}) \simeq H^0(X,K_X)$.

Because $\sigma$ is an isomorphism away from $E$, the pullback gives an isomorphism $H^0(\hat{X}\setminus E,K_{\hat{X}}) \simeq H^0(X \setminus \lbrace x \rbrace,\sigma^* K_X)$ and by Hartog's theorem it extends to $X$.

What I couldn't see is why we can extend this to $\hat{X}$ adding the term $\mathcal{O}((n-1)E)$. Using the fact that $\mathcal{O}(E)$ is trivial on $\hat{X} \setminus E$ we get $H^0(\hat{X}\setminus E,K_{\hat{X}}) \simeq H^0(\hat{X}\setminus E,K_{\hat{X}} \otimes \mathcal{O}((n-1)E)$, but I couldn't go further.