When removing the selected module, set it to NULL

Otherwise, when pressing "Remove" again, we will try to remove an already
deleted module.