added sync call in the shutdown script