If drops as you say then it is reading what is happening when shutting down. If coughs when dying then suspect fuel delivery problem. If shuts off like a light switch suspect spark loss. Check for both when diagnosing. If unsure of how have a qualified shop look at it.