Mycelium growing on grain in jars needs some gas exchange, because it needs oxygen for the conversion of nutrients.
In order to achieve this gas exchange the jars have to be either fitted with a polyfill filter or a filter disc, or the jar lid must remain loose and covered with a piece of tinfoil. A filter of some kind is preferred though since the contamination problems are less compared with a loose lid.