The short answer is, yes they can.
If the government feels the effective use of public money is at risk, withdrawing funding or terminating a contract early is a reasonable action to take. Fortunately, though, these decisions cannot be taken lightly.
The Compact outlines agreed good practice for both sectors when entering into or concluding a financial relationship. In knowing these commitments, you can ensure any decision made is a fair one.