Fix a null reference error for camera deviceSource when application turned off.