Truncate before write in mock file system

Fixes #81