Add cancel method to File object.

Change-Id: I522c06b14673b3be695e6b8e4285a13fcc5f71a0
Clean up code.

Change-Id: I9a1957b5020ec10abc41d68c34e0cfb70226f25d