private void deleteFileIfEmpty() throws IOException {
  if (Files.size(preferencesFilePath) == 0) {
    Files.delete(preferencesFilePath);
  }
}

private void deleteFileIfEmpty ( ) throws IOException { if ( Files . size ( preferencesFilePath ) == 0 ) { Files . delete ( preferencesFilePath ) ; } }
it may happen that the file is empty when the process is forcibly killed , so remove the file if that happened .
