CMFileManager: Check write operation

Check that write operation writes exactly the expected bytes to the backend filesystem.
Otherway, retry the write operation.

Change-Id: I69911d6ce2260b616ce28614fc9ca3a55d474105
JIRA: CYAN-2129
Issue: https://jira.cyanogenmod.org/browse/CYAN-2129
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>