Have raw file bean flush file metadata.

This commit is https://github.com/mtbc/openmicroscopy/commit/32d510cf8e096cdbb5cdcd395870e8ca12e99d4e rebased back from develop. The main thing to check is probably that imports still work and that the file information in the `originalfile` table ends up correct.