Add thread-safe port allocation and proper cleanup on process exit to prevent port conflicts in concurrent environments and ensure containers are stopped when the application terminates. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>