Addded function to stop mnesia when application stops.