Learning to Operate in Open Worlds by Adapting Planning Models