Handle NS_ERROR_FILE_NAME_TOO_LONG and try with a shorter file name.