mmsd: Close file only if writing succeeded

This avoids some criticals when reading the same MMS file
multiple times
8 jobs for wip/sadiq/close-only-opened-file in 15 minutes and 11 seconds (queued for 1 second)
latest