Fix issue 245. If we open files to create a bookmark we should close
them again afterwards.