Quick and ugly fix for :dets file close

This should be done in a terminate callback.

Signed-off-by: chatgris <julien.boyer@af83.com>