Switch base class of PortNotFound and InvalidAccess errors to OSError so it works with <3.3.