Implemented a proper shutdown function

This was done mainly because my root fs had to recover it's journal
everytime on boot.
Also minirc should be responsible for undoing things it has done on
boot when it will be stopped. This has been taken care of.