Wow what a detailed reply, more than I had hoped for. Thank you so much.
I think I get it now. In general the bolt will lock to the front after the last round unless by some magical timing the shooter releases the trigger as bolt is on its way to chamber/fire the final round which will send it back and with the trigger released it will lock.
Perfect, need to make some adjustments to my project but it is very clear now.