What Blender version? Blender installed from Ubuntu repositories or downloaded from the Blender website? Does the problem happens with any scene?
You open Blender from Ubuntu terminal, apply the script and when the problem occurs, you see if you find any useful error message at the end of the terminal.
Blender does crash when it runs out of memory. You are adding a modifier that uses memory. What else is in your scene? How much memory do you have? Are you running the latest Blender?