Corrected bad_weak_ptr (store isReleased flag) and use release() function to release locks instead of manually doing it. Closes #233. Closes #234.