Используя try, наконец, исправьте ошибку, и внутри, наконец, закройте BufferedWriter и FileWriter
try {
BufferedWriter bw = null;
FileWriter fw = null;
try {
final String fileName = getFileName();
File propertiesFile=new File(getFilesDir(), fileName);
fw = new FileWriter(propertiesFile);
bw = new BufferedWriter(fw);
bw.write(s);
File file = new File(getFilesDir(), fileName);
}finally{
if(bw != null){
bw.close();
}
if(fw != null){
fw.close();
}
}
} catch (Exception e) {
}