Fixes metadata handling in flat_correct and adds metadata to test ccd image

Should not be merged until after cosmic ray changes are done