Added configuration parameter to close db properly in plocal mode.