adding slightly improve sync code. Fixed typos.
adding explicit release of VideoWriter