bladeparts: cleanup & fix crash

Calling getFD().sync() on FileOutputStream fails.
Cleanup and move writing values to utils.

Change-Id: Ia5b828c45d0bab90f10c4698dc9701fc46a43aae