Controlled gas exchange in whole lung bioreactors