Fixed crash on Mac when saving figure. Add extension on Mac to figure filename if not provided.