Error thrown

Call to a member function closeCursor() on null