Fix assert in btreeblk_end due to access of freed memory

In a failure scenario, calling btreeblk_end after filemgr_close
can end up attempting to access freed memory in file handle,
which can cause unpredictable crashes

Fix by calling btreeblk_end() before calling filemgr_close

Change-Id: I7bca9128c473653c190634b6185694e52a986ca4