// Call the entity to write itself to the output stream.
entity.toWriter(writer);
writer.flush(); // Muy importante
gos.finish(); // Muy importante mucho!
} catch (Exception e) {
throw new ObjectFlushException("Failed to save entity: " +
entity.getKey(), e);
} finally {
closeQuietly(writer);
closeQuietly(gos);
closeQuietly(fos);