As with most Shakespeare plays, we do not really see what happens in Hamlet after the curtain falls. We do not know if things were straightened out in Denmark, but of course they were somewhat better. I can imagine that the country was quite shaken, though, and took awhile to recover.
With Hamlet's death, everyone involved with the scheming and plotting surrounding the murder of the former king and its aftermath is dead. Claudius, Gertrude, Hamlet, Polonius, Laertes, Rosencrantz, Guildenstern, and even Ophelia are gone. Only Horatio survives of the major characters to greet Fortinbras as he arrives, as it happens, to take his place as the new King of Denmark. So one could argue that Hamlet did, in fact, cleanse Denmark, or at least its royal palace.