If you want them dead freeze them for a couple of days. If you do it simply overnight they will come back to life.
Maggots can't be kept too long before they go off, a week maybe two is the maximum, and they need care and attention to keep the best out of them.
You will need to riddle them, to remove casters and dead skins, and stop them sweating, so keep a bit of sawdust in them, and replace it after riddling. You also need to keep them in the fridge or a cold atmosphere in a container with air holes.
If you have a 2pint maggot tub, do NOT keep more than a pint and a half of maggots in it.
You may also want to know how fresh they are before you try to keep them; if the thin end has a large black spot then they are fresh, as the spot shrinks they are getting older, so give you so idea if you need to freeze them.