update Nansat.write_figure to test type of fileName