smal fix to make vidoe capture initialization more robust, small fix to make window closure more robust