Patch to fix MSMF video capture

Attached commits should fix the bug related to MSMS video capture reported in the ticket 3621 (http://code.opencv.org/issues/3621).
Problems fixed:
- Video device wasn't closed properly.
- It was not possible to change the frame size of the device.
- The feature to set/get frame rate was missing.
Improvements:
- Minor code refactoring and optimization.