When writing cover file, make sure to flush all data

Otherwise, the file will appear truncated to other programs; some will
display it as damaged, and GNOME Shell will refuse to load it entirely.
Grab media keys from mate-settings-daemon