Effects of introducing a gas into the free-electron laser