LPS-30234 Prevent EOF race condition