Make sure file will be deleted if exception happens