Check if writing dump files was successful

Fixes issue #98 reported by Martin Maurer. Thanks!