Check that the progressCallback is defined before calling it

Fix issue #3367

When calling getDocument without a progressCallback we get an error when trying to call it.