The MCI_CLOSE command message releases access to a device or device element. MCI frees a device when all tasks using a device have closed it. To help MCI manage devices, applications should explicitly close each device or device element when finished using them.
Note:
It is very important that applications close all opened MCI devices before exiting. You can close all devices with a single command by specifying the MCI_ALL_DEVICE_ID constant as the device ID.