remove metadata even if writeFits fails (try/finally)