Saves file with proper extension