Fix issue with premature connection close on export

This is the fix for CORE-3015.