Implement shutdown hook
Protect from null pointer if no instance was saved.
Clean master exit from user's perspective.
Change default master state path.