CO2 content of normal air is much lower than the 5% you have in your incubator. If exposed to the normal air, CO2 - which is dissolved as HCO3- and H+ - will diffuse out of the medium. Hence acid is leaving the medium and pH rises.
DMEM is buffered for high CO2 which is maintained in CO2 incubator. Your DMEM probably has 3.7 g sodium bicarbonate which will provide a pH of 7.4 in 10% CO2. If you remove the high CO2, the sodium bicarbonate takes over and you get a basic pH as the buffering capacity of the bicarbonate buffer depends on CO2 which led to the result of more basic pH. Other, the HEPES was not in a concentration strong enough to control the pH effectively. You also cannot add too much HEPES as it is potentially toxic. If you use DMEM you will need a CO2 incubator.