write the rendered image when pressing '`' and on exit.